SDL_mixer + MIDI = Weak
When I first starting using SDL to program Psychedelic Kiwi, I was a bit disappointed when I couldn’t find an usable way to integrate MIDI music files into my game. The library SDL_Mixer claimed to have support for MIDI files, but oftentimes required special programs (such as Timidity) on the user end to get it working. What the fuck?
So I resorting to using MP3s. However, the size of MP3s is signficantly larger than MIDI files. MIDI songs have a filesize around 10~50kb while MP3s can take up more than 3mb, depending on song length.
So I began reading the SDL_Mixer documentation to see what other file types they supported. Out of many, the one that caught my eye was the XM (FastTracker 2) format. XM files are sort of like MIDI files such that the notes are digitally stored, however they take up a bit more space than MIDI files (yet still is significantly smaller than MP3s). For example, my 5 minute midi file MIDI (~20kb filesize) turned out to be around 300kb when converted to XM.
There is this free & open source program online called Modplug tracker (Windows) that lets you easily convert Midi files to XM files.
To convert a MIDI file to XM, you can do as follows:
- Open up ModPlug Tracker
- Open up your MIDI file
- In the Song Type box, change it from “IT” to “XM (FastTracker 2), 32 Channels”
- To save as XM. Go to File->Save As
Although SDL_Mixer also supports IT format, I found the sound quality to be so much shittier than that of XM files.





