Skip to content
May 2, 2012 / Mr Megahertz

YM2149 and MIDI

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. :)


Schematics:

Schematics
Arduino code: http://pastebin.com/BzaMhtuj

About these ads

16 Comments

Leave a Comment
  1. asselinpaul / May 5 2012 4:41 pm

    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.

    • Oryx / May 5 2012 10:38 pm

      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.

      • asselinpaul / May 5 2012 10:44 pm

        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…

      • Oryx / May 5 2012 10:54 pm

        Yep, I use an usb/midi adapter. And if I want to play live, I can plug my midi keyboard to this circuit, too.

  2. liz_clark / May 5 2012 8:24 pm

    this was a pleasure to listen to. very impressive arduino project. can’t wait to see/hear more!

    • Oryx / May 5 2012 11:38 pm

      Thank you!

  3. asselinpaul / May 6 2012 12:55 pm
  4. Matthew1471! / Jun 22 2012 3:51 pm

    Awesome. Any chance of a MOD or XM of the chiptune?

    • Oryx / Jun 22 2012 6:50 pm

      Thanks!
      Not really, I made this song in Logic.

  5. Jesper Rossen / Oct 31 2012 6:36 pm

    Is it possible to use the atmega168 without any special editing in the code?

    • Oryx / Oct 31 2012 7:13 pm

      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.

      • Jesper Rossen / Nov 4 2012 3:17 pm

        So I guess the atmega328 would be a good choice :P By the way, I have just finished developing a shield based on your schematic. Gonna test it soon :)

      • Oryx / Nov 5 2012 2:28 am

        Nice, let me know when it’s done! :)

  6. Aron / Sep 17 2013 2:02 pm

    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?

    • Oryx / Sep 24 2013 10:44 am

      Hi,
      I just didn’t know such a lib existed. ;)
      Thanks for the tip!

Trackbacks

  1. Quora

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 25 other followers

%d bloggers like this: