tracker2ay

Here’s a utility prompted by zxbruno and Eq both asking, in the space of two days, how to convert STC, SQT and PT3 music files to something you can actually play on a Spectrum. For those not in the know, STC and friends are Spectrum tracker file formats originally introduced by Sergey Bulba‘s AY Emulator and which are now the de-facto standard for archiving Spectrum demoscene music (most prominently on ZXDemo, ZXTunes and Sergey’s epic Tr_songs archive). Which means it’s a bit unfortunate that there’s not been an obvious way to transfer them back to the Spectrum.

In principle it should just be a case of locating the appropriate Z80 player routine and bundling that together with the music data. In practice it involves a lot of faffing about (such as repointing pointers to make up for slight rubbishness in the SQT data format, and writing a 5-line Basic loader/player). Now, thanks to this utility, you just need to type tracker2ay mysong.stc mysong.tap instead. (Oh, and it can convert to TAP, TZX or AY.)

If at this point you’re screaming “But why does it have separate source code if it’s written in Ruby, which is an interpreted language?” then award yourself 20 geek points. Ah, you see, this time I’ve been playing with rubyscript2exe (and tar2rubyscript) to create all-in-one executables that everyone can enjoy without worrying about library dependencies and things. (But obfuscates the code in the process. But in a good way.) Please do check out the source code if you’re curious about that sort of thing, because I reckon it’s one of the best bits of code I’ve written in a long time, in a ‘nicely-written code’ sort of way rather than ‘evil complicated hacks that go together to do something superficially elegant’.

6 Responses to “tracker2ay”

  1. [...] matt.west.co.tt adventures of a retro electro media hacker type person « tracker2ay [...]

  2. F6 says:

    It works :)

  3. Karl McNeil says:

    Very useful,

    Thanks a lot… saves me flipping between several utilities and programs to accomplish the same task… thanks!

  4. spindizzy says:

    This utility is exactly what I’ve been looking for, since it allows me to listen to Tr_Songs on Linux (which has an AY player but no support for tracked tunes).

    Unfortunately, it doesn’t support .PT2 which is a pretty big drawback from my perspective. I tried renaming PT2 to PT3 in the hope that the format was backwards compatible, but it doesn’t seem to be.

    Is there any chance of adding support for earlier protracker formats? Failing that, is there anywhere I can find the file format spec in English?

    I tried running the Russian PT2 spec on Serge Bulba’s site through BabelFish, but the result wasn’t encouraging.

    Anyway, despite that complaint thanks for writing an invaluable tool.

  5. matt says:

    Sure, adding PT2 wouldn’t be too hard – I just didn’t think there’d be as much demand for it as for the Big Three :-) Will look into adding that when I get a free moment (some time in the next month I hope…) – it should just be a matter of dropping in the appropriate player code.

    Have you seen Ayfly? It’s a cross-platform AY player that handles PT2 and more. Looking at the code, it seems to ‘cheat’ slightly by running the original Z80 routines under emulation – which means I’ll probably snaffle those routines for myself when I update tracker2ay :-)

  6. spindizzy says:

    That would be great, thanks!

    I hadn’t heard of Ayfly before. It compiled easily on Xubuntu and looks like it could be good when it’s more mature. However, the sound emulation doesn’t seem quite right yet.

    Anyway, I prefer tracker2ay for several reasons:

    1. It follows the “one tool for one job” philosophy.
    2. I can run from the shell, batch convert a ton of files etc.
    3. It’s written in Ruby, so it’s portable and potentially hackable.
    4. The documentation isn’t in Russian. :)

Leave a Reply