Lately I've been writing an YM player for the Neo Geo Pocket Color. In case you don't know, .YM files are register logs (16 bytes per frame) for the YM2149 chip and its clones (like the AY-3-8910). These chips were used in the Atari ST, ZX Spectrum, Amstrad CPC, and probably a lot of other '80s home computers and arcade machines.
While the sound chip in the NGPC is quite similar to the one found in the SEGA Master System, which in turn is relatively similar in capabilities to the YM/AY chips, there were differences that made me not choose to emulate the YM/AY using the NGPC's PSG (for example, it can't generate low-enough frequencies).
So what I do instead is to generate PCM data and output it to the NGPC's 8-bit audio DACs. This is of course a lot more CPU-intensive, so I had to settle for very low sample rates. Currently the maximum output sample rate I've been able to use is 8 kHz. The NGPC's main CPU (a TLCS-900/H) runs at 6.144 MHz, with every two cycles making up one CPU state. At an 8 kHz sample rate this gives me 3072000/8000 = 384 states per sample. The fastest instructions take 2 states to complete, but most take more.
Here's a video of the first version which used a 6 kHz sample rate.
And here's a video of an optimized version using an 8 kHz sample rate. I've also made the ROM available for this version, which you can run on your NGPC if you happen to own a flash cart (I'm unsure if there are any emulators available that will run it correctly).
While the sound chip in the NGPC is quite similar to the one found in the SEGA Master System, which in turn is relatively similar in capabilities to the YM/AY chips, there were differences that made me not choose to emulate the YM/AY using the NGPC's PSG (for example, it can't generate low-enough frequencies).
So what I do instead is to generate PCM data and output it to the NGPC's 8-bit audio DACs. This is of course a lot more CPU-intensive, so I had to settle for very low sample rates. Currently the maximum output sample rate I've been able to use is 8 kHz. The NGPC's main CPU (a TLCS-900/H) runs at 6.144 MHz, with every two cycles making up one CPU state. At an 8 kHz sample rate this gives me 3072000/8000 = 384 states per sample. The fastest instructions take 2 states to complete, but most take more.
Here's a video of the first version which used a 6 kHz sample rate.
And here's a video of an optimized version using an 8 kHz sample rate. I've also made the ROM available for this version, which you can run on your NGPC if you happen to own a flash cart (I'm unsure if there are any emulators available that will run it correctly).