I’m still working on my YM2149 synth project.I’ve added an optocoupler and implemented the MIDI protocol in my arduino code. I added support for lo-fi 4-bit drum samples. This was a well-known hack by Atari ST coders: updating the volume of a channel (set at the max level) at a high rate, like a classic DAC.
More to come. 🙂
Arduino code: http://pastebin.com/BzaMhtuj
16 thoughts on “YM2149 and MIDI”
Oh, I love this. A great upgrade. What is the benefit of having Midi in your case (since the audio is piped from the computer)? Also, what is this magical ‘lo-fi 4-bit drum samples’ ?
I have many questions because this is such a cool project. Ultimately, I’d like to build this to craft music for games I make.
In the previous version, I used an USB to serial adapter to send raw data to the sound chip. I had to code a C# app to read .YM files and to stream data to this serial port.
I decided to use the Midi protocol because this is the simplest way to turn this circuit into a synth and to use it with software like Logic Studio or Cubase.
Now the 4-bit sample thing:
This sound chip can only generate square waves, noise and silence. But each channel comes also with a volume control (on 16 levels). By changing this level at a 11kHz rate on a silent channel (which is stuck to 5V), I use this feature like a digital to analog converter.
Drum samples are stored in the flash memory of the Arduino.
but for the midi, you need an adapter right?
I’m going to order the parts pretty soon but I still don’t know whether I should go Midi or Serial. Hope you keep posting everything here along the way. I will probably follow in your footsteps…
Yep, I use an usb/midi adapter. And if I want to play live, I can plug my midi keyboard to this circuit, too.
this was a pleasure to listen to. very impressive arduino project. can’t wait to see/hear more!
I shall like to think that this is perfect 😉
Awesome. Any chance of a MOD or XM of the chiptune?
Not really, I made this song in Logic.
Is it possible to use the atmega168 without any special editing in the code?
As long as the binary code is smaller than 16kb, it is. =)
But this code takes 21k of program space.
You can remove some sample data to gain some space.
So I guess the atmega328 would be a good choice 😛 By the way, I have just finished developing a shield based on your schematic. Gonna test it soon 🙂
Nice, let me know when it’s done! 🙂
Started looking at building something with the YM2149 chip myself, and after stumbling over this, I’m wondering: why did you not use the Arduino midi library for midi communication? (http://playground.arduino.cc/Main/MIDILibrary) Was it too slow or too space consuming?
I just didn’t know such a lib existed. 😉
Thanks for the tip!