Project: libxm_t3 (XM music module player)

Projectitis

Well-known member
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).

teensy_preamp_setup.jpg

Cheers,
Peter
 
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.
 
...

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).

View attachment 13776

Cheers,
Peter

Hi

Which preamp do you use for the headphone?


Alain
 
Good luck. From memory it was really picky about he module you were trying to play. It happened to work well with the module I used for testing, but not others :( More work required. I suggest using Jarkko’s :)
 
Back
Top