PT3 Player - joric/ts80player GitHub Wiki

There are a few ways to play 3 or 6-channel AY-8912 music on small MCU's. You could render PSG stream (AY registers, usually 14 bytes at a time at 50 Hz) or you could parse PT3 modules.

PT3 players

Modules are usually converted to .h files with xxd -i file.pt3 (standard UNIX tool, part of vim). Add const modifier for STM32 and const with PROGMEM for AVR to avoid RAM overflow.

STM32 source:

I've also started writing my own library to test out and benchmark AY emulation code:

Turbo Sound

Turbo Sound (TS, Turbo-AY) utilizes two AY сoprocessors so you get 6 channels instead of 3. Players support Turbo Sound and there are a lot of 6-channel PT3 files in the wild so there's no sense in stripping this option (it doesn't cost anything when you're playing 3-channel files).

PSG compressors

TBK PSG Packer

You could also play compressed PSG. I couldn't find a good streaming compressor except this one:

It uses some kind of LZ-based codec with backreferences to the compressed data (not the decompressed one) so you don't need extra memory to stream it (no ring buffers, nothing). Compression is pretty good, about 20-30% of the file on average (better on big files). Unfortunately there is no decompressors available just yet (the existing one is Z80 asm, so you could port it to C as an exercise). Compressor is closed source and win32 only.

Videos

References