Thursday, May 30, 2013

Tracker music player using XMP

Recently I've been working on a tracker music player based on the xmp library. I got the basics working: the DirectSound stream buffer, a software circular buffer to write audio data, compiled xmp into .dll and .lib and integrated those into my project. Then I wrote a simple command-line based player to test it. Works like a charm!

XMPModPlayer playing 2nd_pm.s3m by Purple Motion of Future Crew

For those of you unfamiliar with the scene, tracker music (or module music) is an old music format very popular back in the DOS and Amiga era and was used by many games and artists of that time and even further. For instance, Epic Games used it on games like Jazz Jackrabbit and Unreal Tournament. It was also very popular in the demoscene; in fact, some tracker music formats (such as S3M and XM) were created by demosceners because they needed something better than what they had -- they needed to do something impressive, which is the whole point of demos.

Tracker music files are very similar to MIDI files, except they also include samples and sometimes instrument information like envelopes, filters, key mapping and such. These formats were very influential, so much that there is a contemporary tracker inspired on them that can take advantage of modern technology such as VST plugins. OpenMPT runs on modern OSes too and plays these old formats without a hitch.

"So, if there are very powerful trackers/players out there, why are you writing a simple player?" For two reasons:
1) I enjoyed tracker music back then, and I still enjoy them today, and I didn't want to use Winamp or OpenMPT to play those songs, and I couldn't find a xmp player for Windows. (Well, this is like four reasons in one... :P)
2) I wanted to learn DirectSound programming, and this proved to be an adequate challenge.

I'm thinking about improving this player quite a bit, making a graphical front-end for xmp but with very advanced visualization features (think Cubic Player, but with more bling), so I can learn Direct3D/OpenGL too. I'll also probably try to implement support for ASIO drivers, mostly for learning purposes.