AVR mod player using ATmega325 microcontroller
In 2006, I took part in an electronic demo competition on a Dutch forum (see this topic). Because computer demos like they used to have on old machines like the Amiga or Commodore are harldy made anymore since hardware has come such a long way, someone had the idea to do the same, but on home built hardware. You could use things like a simple microcontroller but not a complete PC or powerful development board, and had to make something with cool graphics, audio, etc.
The competition never really ended properly since most contestants did not have enough time to finish their projects. I came a long way, at least the audio part was working very well but the video part was both poorly designed and never finished.
My idea was to use an oscilloscope as the video output device to show some vector graphics, and create a mod player to provide the audio. The video part of the project had some design flaws and terrible noise in the DACs so I never really finished that part. Also, the audio part was much more fun. The modplayer was built using an ATmega325, an 4MBit parallel flash memory (AT49F040A) and an op-amp to amplify the audio.
MOD file format
The MOD file format is a combination of audio samples and a set of notes on a timeline. FastTracker was one of the programs you could use to edit MOD files, although it was mainly used for the superior XM format.
A maximum of four channels can be used in a MOD, each can play one sample at a time from the sample set. The sample is played at a specific pitch depending on the note in the channel. Additionally, effects can be added to the notes such as volume or pitch fades.
To get familiar with the details of the MOD format I first wrote a C# program that displayed the patterns in the MOD and could also play the MOD file:
After that I wrote a converter for the MOD into a slightly different format that was nearly the same format but in an easier to handle structure. Then I built a prototype with an ATmega32 on a breadboard. Because no external flash was used in the prototype the MOD had to fit in the 32KB flash of the AVR along with the firmware which limited the prototype to very small MOD files. But it worked.
For more detail: AVR mod player using ATmega325 microcontroller
Leave a Comment
You must be logged in to post a comment.