Some of us here at Hackaday are suckers for a bit of chiptune music as the backdrop for many excellent times. The authentic way to create chiptunes is of course the original hardware, but in 2019 it’s far more common to do so with an emulator on a modern computer. That computer doesn’t have to sport a high-end processor and desktop operating system though, as [Deater] shows us with his ZX spectrum chiptune player on an STM32L46G Discovery board.
The impetus for the project came he tells us while teaching students to code simple sine wave music players, having code already in the bag for emulating the classic AY-3-8910 sound chip on the Raspberry Pi and the Apple II he decided to port that to the STM32L476 dev board. An earlier version used the internal DAC, but this was refined to send I2S data to an external DAC. The code can be had from GitHub (confusingly buried among code for an LED driver), and we’ve attached a video below of it playing some chiptune goodness.
Of course, Sinclair chiptunes don’t grab all the limelight. There have been plenty of Nintendo and Sega players too. You might also recognize [Deater] from his non-chiptune work, porting Portal to the Apple ][.
Nice project, but the board is overkill to play some chiptunes. All you need is a 28 cent ATTiny9:
https://www.youtube.com/watch?v=ycfYZpyQRzw
I would tend to agree — since the chiptunes are being simulated rather than being produced by the original chip.
(In this case any chip capable of simulating them would work, and the cheaper, the better).
Look harder at the OP’s project! It doesn’t just play tunes, it emulates old hardware, and this virtual hardware is called from a pretty featureful tracker.
This one is much deeper than it looks on the surface.
Just to be clear, there was no soundchip in the original ZX Spectrum.
The sound output was a nothing but a 1 bit digital output, no volume control, no DAC, it was all done in software. There was not even a dedicated hardware PWM. The sound was all made by the Z80 CPU microprocessor writing that output single bit latch.
Absolutely right. This is emulating the more accomplished chip found in the later models.