I've had a soft spot for OPL2 music ever since I was a kid playing DOS games on my parents' computer. Hearing the Apogee fanfare tune after typing in the exe always meant I was gonna have a great time and I fondly remember the music from games like Commander Keen, Hocus Pocus, Bio Menace and many more!

The music is produced by the Yamaha YM3812 audio chip that was used in the Adlib and SoundBlaster sound cards. After reading through the datasheet of the YM3812 it seemed easy enough to hook it up to an Arduino and play some tunes. I started by adding a 74595 to serve as a serial interface to the YM. I send data to it using SPI. At first I overlooked that the YM requires an external Y3014B DAC and an OPAMP for you to actually hear anything, so I became a bit confused as to how to get the audio out of the chip. I started looking around for schematics that could show me how others did it. I found several.

The first one I found linked in a forum post on the EEVblog. It seems to be from a C64 sound expander. I copied the filtering stage on my breadboard, but all it did was produce terrible hissing and other noises. With a bit more searching I found the reconstructed schematic of the actual Adlib card. The filter used in that one was also quite involved and also didn't work for me. So I started to poke around with the speaker wire until for the first time I could hear some OPL2 music through the noise that this circuit was producing. From there I started experimenting by adding and removing components until I settled on an LM358 OPAMP and two 10 uF caps which give me great audio, as you can hear form the demo video.

I drew the schematic and PCB layout in Fritzing and sent it to them to have my PCB produced. I turned out really nice. Note that the board does need an external amplifier. The code in the video is playing a DRO file (IMF is also supported) from an SD card that was captured using DosBox from the game Stunts. You can find the OPL2 library that I wrote for this project on my GitHub page.