I seriously like the Teensy series of Arduino compatibles – they’re basically Arduinos but with all the correct possibilities!
There are two principal varieties of Teensy, the two series and the three series. The two series are 8bit Atmel AVR – incredibly significantly like standard Arduinos but with native USB and significantly much better library implementation. The three series are Freescale 32bit ARM CPUs – this is the series I specifically take pleasure in. I decided to purchase two Teensy++ two.o and two Teensy three.2 along with a few audio adapter add-ons for the Teensy three.two.
What much better way to test the audio adapter then to emulate the SN76489, a.k.a. Sega Master Technique PSG / Genesis PSG.
The SN76489 programmable sound generator consists of four channels: three square wave generators and 1 noise generator. A incredibly detailed explanation of the PSG’s inner workings can be found here.
I set out to create a Teensy three.two library which can read VGM files and 0utput the corresponding emulated audio out to the Teensy three.two audio adapter.
VGM files discovered on the web are commonly compressed. You can effortlessly verify with a normal HEX editor to see if the initial three characters of VGM file are ‘VGM’. If so, your file is not compressed. If you see anything else, you will will need to uncompress your VGM file initial.
Linux customers can do the following to extract the archive and create a C compatible header with the information:
7za -e %vgmfile%xxd --contain %extractedvgmfile% &> %file%
Windows customers can ask Google :p
Teensy Audio Library
Fortunately, Paul at PJRC (creator of the Teensy) supplies incredibly excellent software support to develop custom audio objects. In reality, it was fairly significantly as easy as declaring a class which inherits from Paul’s Audiostream and implementing an update() function to present 128 audio samples of information to the Teensy – anything else is handled by the offered Audio Library!
I’ve as a result far managed to make my solution play an incorporated .h file of VGM information. I’d like to take it a bit additional and have my SN76489 library be capable to study uncompressed VGM files from an SD card and play them at will. Lastly, it would be terrific to add YM2413 help.
Right here is a hyperlink to the Github repository containing this project: