Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Project: libxm_t3 (XM music module player)

  1. #1
    Senior Member Projectitis's Avatar
    Join Date
    Feb 2018
    Location
    New Zealand
    Posts
    114

    Project: libxm_t3 (XM music module player)

    Hi all,

    I've uploaded the latest version of libxm_t3 to github: https://github.com/projectitis/libxm_t3
    libxm_t3 is a port of a compact XM player, libxm by Artefact2: https://github.com/Artefact2/libxm

    I've only tested on T_3.6 so far, but should also work on T_3.5, T_3.2 and T_3.1, though it drops to mono output for the latter two (only 1x DAC available) and also drops to 24kHz - not sure if it needs to. If someone wants to test this on T_3.5, T_3.2, T_3.1 I would be much obliged.

    The original author was instrumental in helping implement a low memory mode where a module can be played almost entirely from Flash memory, with only 10kb or so of RAM used.

    Only XM files are supported at this time (not MOD, S3M etc).

    I'd like to acknowledge Jarkko, who has recently completed a similar project: https://github.com/JarkkoPFC/arduino-music-player
    Jarkko's player uses even less memory than libxm, but I started this port because I didn't want to rely on an intermediate file format. Jarkko's player uses his own PMF (Profoundic Music File) format, and requires files to be converted to this first. I was only partially successful - libxm_t3 allows playing the original XM (as long as it is converted to header file first - still working on SD card loading), but in order to use the low memory mode, the XM does have to be converted to a slightly different file format.

    Examples are included in the repo, and I plan to add to this library over time - next up is loading from SD card.

    Here is example code to play a low-memory XM file:
    Code:
    #include <xm_t3.h>
    #include "shooting_star_libxmize.h"
    
    void setup() {
    	// Loading the module in libxmize format results in:
    	//		104 kB of flash memory used
    	//		10 kB of RAM used for module
    	xm_player_xmize( shooting_star_libxmize );
    	xm_player_start();
    }
    
    void loop() {
    	xm_player_update();
    }
    And here is my Teensy setup. Note the output of the DACs are going through a preamp and then on to my speakers. I have also been successful connecting the DAC pins directly to powered speakers. What you can't see in the photo is that I have an external 3.3v power supply hooked up to the power rails running along the top (powering the preamp).

    Click image for larger version. 

Name:	teensy_preamp_setup.jpg 
Views:	24 
Size:	172.8 KB 
ID:	13776

    Cheers,
    Peter

  2. #2
    Senior Member Projectitis's Avatar
    Join Date
    Feb 2018
    Location
    New Zealand
    Posts
    114
    Included in the source is the code that creates a low-memory version of the XM module so that it can play directly from Flash mem (called a 'libxmized' version by the original author). However, currently that code needs to unpack the module completely to memory first, so it can only process XM files that are reasonably small (around 100 - 150kb). I'm currently working on a version that doesn't need to do this - it converts the module files on the fly so that even large modules can be played from flash mem. So be aware, only smaller XM modules will currently play.

  3. #3
    Senior Member Projectitis's Avatar
    Join Date
    Feb 2018
    Location
    New Zealand
    Posts
    114
    Finally got around to a video of this in action. Sorry, not much to see!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •