YM2149 MIDI Synthesizer on ZPUino Soft Processor

While browsing through past HackaDay articles looking for projects to spark the imagination we noticed a trend. It seems that people are keen on connecting the audio chips from old computer and arcade games to their Arduino! Heck, while we were writing this wiki page a new project showed up on hackaday!

Seeing all these cool projects led us to a moment of inspiration. We could use the features of the new ZPUino 1.0 soft processor to take this type of project to the next level on the Papilio FPGA! By using the Open Source VHDL files for popular audio chips from places like FPGAArcade.com and Opencores.com we could eliminate all the wires, soldering, and wasted GPIO pins. Integrating popular audio chips like the C64 SID, Atari POKEY, and YM2149 into the ZPUino would put them under control of Arduino sketches. Effectively opening up all the Arduino libraries to control the audio chips. Fortunately, Alvaro had already done the heavy lifting of converting the YM2149 into a wishbone core and integrating it into his amazing ZPUino Soft Processor. So it only took a couple hours to hack in the Arduino MIDI library, splice in Arduino code snippets from the Hackaday articles, and end end up with a sketch that turned the Papilio into a YM2149 MIDI Synthesizer!

Whats next?
The ZPUino 1.0 release has C64 SID, POKEY, and YM2149 audio cores integrated into the codebase. So the next step is to make a MIDI synthesizer with the C64 SID core. The C64 SID has built in support for ADSR envelopes so we can define instruments such as a trumpet, drum, piano, or organ very easily in our sketch. If we can get the SID, POKEY, and YM2149 cores all running at the same time and can define instruments with the SID then we can use buttons to switch between which chip or instruments we are playing.

The ultimate goal is to get as many audio cores as we can find converted to work with the ZPUino. There is open source VHDL for NES, Atari 2600, SoundBlaster FM synth, and other sound chips that is available. It would be fun to be able to play all of them individually, together, or create a hybrid that uses 3 SID voices, 3 YM2149 voices, and 3 POKEY voices. Or we could make a SUPER SID that implements 20 SID voices instead of just 3. The FPGA gives us the ability to create things that have never existed in hardware before.

Supported Hardware

Downloads

Usage

  • Download the latest version of the ZPUino IDE.
  • Download the latest version of the Papilio Sketches and extract them to a folder of your choice.
  • Open the ZPUino IDE and then select the sketch from the sketch directory Audio/YM2149_Synth.
  • Ensure that you have the ZPUino "Apollo" variant bit file (see download section) that includes the YM2149 audio chip loaded to your Papilio. (We recommend loading it to SPI Flash.)
  • Ensure your MIDI Audio Wing is connected to the Papilio.
  • Plug your Papilio into a USB port.
  • Set the Board Type to either ZPUino on Papilio One 500 or 250 depending on which board you have.
  • Select the Serial Port in the ZPUino IDE.
  • Modify the #define section to uncomment out what type of hardware you are using.
  • Press the Upload Icon (this will load an already converted ym file).
  • Make sure your MIDI instrument is plugged in, and start playing.
  • Once you are done playing check out the sketch to play YM files.

Reference

Links to related projects

Technical Details

The YM2149 vhdl file is an open source recreation of the original YM2149 that was created by the good people at FPGAArcade.com by studying the datasheets and characteristics of actual hardware. Originally used for the VHDL recreations of games like Frogger. Inspired by projects like this one where people physically connected YM2149 chips to the Arduino we decided to make a streamlined ZPUino solution that does not require soldering or use up GPIO pins. Shaz and Alvie ported the chip to a wishbone compatible core that can plug into the ZPUino architecture, providing direct register access without using any of the ZPUino GPIO pins. The power of the ZPUino and the large code base of the Arduino allowed cool applications like this player, a streamer, and a MIDI controlled YM2149 synth to be easily and quickly realized!

Attribution

  • ZPU team for Soft Processor that is the base for the ZPUino.
  • Arduino team for the IDE and Open Source example to learn from.
  • Alvaro Lopes for his amazing work with the ZPUino.
  • MikeJ at FPGAArcade.com for making the YM2149 VHDL files Open Source.
  • Shaz for providing the momentum to port the YM2149 to a wishbone core.
  • Jack Gassett and the Papilio team for the Open Source FPGA hardware and examples.
  • Leonard for the ymtool application used to convert ym files.
  • Sergey Bulba for Delphi source for YMDump tool.

License

The example code and documentation is released under a Creative Commons Attribution license. Please use the code any way you want but do the right thing and mention the Papilio if you are porting this project to other hardware. Especially if it is a closed source FPGA board like the Cyber Cortex.

The source code for the ZPUino is released as BSD style license.

The source code for the YM2149 core is released as GPL.

Please drop us a line if we are missing any attribution or have any licenses wrong.

  

Share |