Arduino MIDI Chiptune Synthesizer




Introduction: Arduino MIDI Chiptune Synthesizer

Relive the fun of early computer game music with an authentic 8-bit chiptune synthesizer, which you can control over MIDI from the comfort of any modern DAW software.

This simple circuit uses an Arduino to drive an AY-3-8910 programmable sound generator chip (or one of its many clones) to recreate that 1980's sound. Unlike the many designs that need specialised software to edit music, this looks like a standard USB MIDI device. The synthesizer has a clever algorithm which tries to keep the most musically-relevant notes playing; in many cases you can throw un-edited MIDI files straight at it and the tune comes right out. Total cost should be about £20.

Step 1: Things You'll Need

The full parts list for this, as you see in the pictures, is as follows:

  • Sparkfun Pro Micro clone (5V, 16MHz option). I used this one on Amazon.
  • Yamaha YM2149F PSG chip. I got mine from eBay.
  • 2 x 100nF ceramic capacitors
  • 1 each of 75R, 1K and 100K resistors (1/4 watt rating is fine).
  • 4.7nF ceramic disc capacitor
  • 1uF electrolytic capacitor (voltage rating > 5V).
  • 40 pin 0.6" DIP IC socket
  • 2 x 12 way 0.1" headers (this one from CPC)
  • Prototyping board, 3" by 2" approx. I bought a bulk pack of these, again on Amazon.

  • PCB mount phono socket
  • Miniature solid-core wire (like this).

You will also need a soldering iron, solder, wire cutters, pliers, and a wire stripper.

Step 2: Alternative Parts

Alternative programmable sound generator chips

The YM2149 I used is a clone of the original General Instruments AY-3-8910 IC. (The first prototype used an AY-3-8910 I bought from eBay, but it turned out the white noise generator wasn't working. Sad face). You can use either for this project without any changes.

General Instruments also made AY-3-8912 and AY-3-8913 variants, which was the same silicon inside smaller packages, without some extra I/O pins. These pins aren't needed for any audio purposes, and this project doesn't use them. You can use an AY-3-8912 or -8913, just follow the pinouts shown above.

Alternative Arduinos

The "Pro Micro" I used is a copy of Sparkfun's Pro Micro board. If you're not confident with Arduino code it's best to stick with this; if you're happy to adapt the design, you'll need the following specifications

  • ATmega 16u4 or 32u4 device (needed to act as a USB MIDI device; the ATmega 168 or 328 can't do this).
  • 5V operation (the AY-3-8910 runs at 5V), and 16MHz clock speed.
  • At least 13 digital I/O lines.
    • Port pin PB5 must be connected (it's used to generate a 1MHz clock signal). On the Pro Micro this is used as the D9 I/O pin.

The Arduino Leonardo and Micro boards both fit the bill, although I haven't tried them.

Other components

The resistors and capacitors used here aren't particularly special. Any parts of (approximately) the right value should work.

Step 3: Laying Out the Circuit Board

To build the circuit, it's best to start by positioning the sockets, then add the resistors and capacitors. We'll cover wiring these together in the next step.

Using the picture above as a guide, position the 40-pin IC socket, turn the board over and just solder in two opposite corner pins first. If the socket isn't then lying flat against the board, it's easy to fix by resoldering one or other pin. When it's OK, solder the rest.

Position the two 12-pin sockets, then insert the Arduino into them to hold them vertical and steady during soldering. Again, soldering two pins at each end first will allow a check before final soldering.

For the audio output socket, I used a small drill to enlarge the PCB holes, as the mounting tags are rather large.

Step 4: Wiring Up

Once the major components are positioned, they can be wired up on the back of the board, following the circuit above.

The audio output components (R2, R3, C2, C3) and decoupling capacitors (C1, C4) can be connected up with solid-core wire (or off-cuts of component leads). The ground and power connections from the Arduino to the PSG chip (red and black wires, in the picture) can now be made.

The Pro Micro's various outputs are wired up to the AY-3-8910 as follows (see the hookup guide for pin assignments):

Signal   Arduino  AY-3-8910 pin

  DA0      D2        37
  DA1      D3        36
  DA2      D4        35
  DA3      D5        34
  DA4      D6        33
  DA5      D7        32
  DA6      D8        31
  DA7      A0/D18    30
  BC1      D10       29
  BC2      MOSI/D16  28
  BDIR     MISO/D14  27
  RESET#   SCLK/D15  23
  CLOCK    D9        22 (via R1, 75 ohm)

Step 5: Programming Using the Arduino IDE

If you're new to Arduino, I'd strongly recommend trying one of the many tutorials on the basics. Sparkfun's hookup guide gives full details. You can check that the basic programming is working by following the "Blinkies" tutorial. Arduinos can be a little tricky to persuade into 'bootloader' mode (where you can load new sketches), so a bit of practice with a simple example is useful.

Once you're happy, download the chiptunes.ino file attached to this page, and build and upload it. (I've found that using the "Arduino/Genuino Micro" board type is OK for this sketch, if you want to skip installing the Sparkfun board support).

Also, note that if you're on a Mac, the "Port" setting will need to be changed once you've loaded the sketch for the first time. With a 'blank' Arduino (or using the Blinky sketch) it will appear as something like /dev/cu.usbmodemXXXX, as shown in the picture above. When the USB MIDI device is active (as used by the chiptunes.ino sketch) it will be /dev/cu.usbmodemMID1.

Step 6: Testing and Using the Synth

Once the Arduino is programmed, your workstation should automatically recognise it as a USB MIDI device. It will appear with the name 'Arduino Micro' - you should be able to see this on Device Manager in Windows, or the "System Information" app in Mac OS.

On a Mac, you can use the Audio MIDI Setup app to run a basic test. Start the app, then choose Window -> Show MIDI Studio. This will bring up the MIDI Studio window - all your MIDI interfaces will appear in a slightly random arrangement - which hopefully will include the 'Arduino Micro' device. If you click the 'Test Setup' icon in the toolbar, and then click the down arrow (see picture) on the Arduino Micro device, the app will send MIDI notes to the synth. (These aren't particularly tuneful!) The synth should make some random sounds at this point.

You can then add 'Arduino Micro' as an output device to your Digital Audio Workstation's MIDI setup, and start to play!

  • The synth responds on MIDI channels 1 to 4. Each channel has a different sound (well, a different volume envelope).
  • MIDI notes between 24 and 96 (C1-C7) are accepted; notes outside this range are ignored.
  • MIDI channel 10 plays drum sounds. Note numbers between 35 and 50 (see are accepted.

  • There are three voice channels on the AY-3-8910. The synth firmware tries to play the most recently sent note, while keeping the highest and lowest currently-requested notes still playing. Other notes (usually the middle notes in a chord) are cut off if necessary.

And that's about it. Have fun!

Step 7: Footnotes

About the demo tune

The demo tune - Mozart's famous Queen Of The Night aria - was created reasonably quickly from a MIDI file I found on the Internet ( Someone else did all the hard work!

I'm using Presonus Studio One on a Mac, and the MIDI file was imported to four separate tracks. A small amount of editing was needed where the accompaniment notes are higher than the main tune, and to remove some of the more objectionable glitching between notes.

The audio you hear on the clip is straight from the synth, with just a touch of EQ and saturation to give it a bit of an 'arcade machine' low-fi feel.

4 People Made This Project!


  • Retro Tech Challenge

    Retro Tech Challenge
  • Sewing Challenge

    Sewing Challenge
  • Audio Challenge

    Audio Challenge



19 days ago

Thanks for the write-up! I followed your guide and built mine though in a slightly less professional looking way (dead-bug style).


21 days ago

I'm building this with an AY-3-8913 which does have a BC2 pin. Does that make any difference to how I wire this up?


5 months ago

is it possible that this is not perfectly in tune with the midi notes ? i get lower notes sometimes.. so not possible to play a full 12 key scale ? or maybe my ay-38912 is damaged ?


6 months ago

For anyone hoping to have simultaneous 5-pin MIDI Input and USB-over-MIDI, I finally got it working! Hope this helps:

1. Set up your optocoupler circuit --
2. Install MIDI libraries. Add "#include <MIDI.h>" to your preamble.
3. Add ";" in your loop() section.
4. Add the following to your setup() section:


5. Enjoy!

The only thing I'm noticing is that the 5-pin MIDI Input is translating input to the wrong channel -- it is seeing the percussion channel (10) on channel 9. Not quite sure why it would do this offhand, but I'm a noob. Any ideas?


Reply 6 months ago

you should change the channel in the code. search for:
static const uint8_t PERC_CHANNEL = 9;

and change it to 10, or whatever you want.


Question 7 months ago

All I get is a tick, tick, tick... Any suggestions? Does the demo autostart? How do you play midi files on Windows 10? Thanks.


Question 1 year ago on Step 1

Hi awesome project. Would it be possible to have a real midi in connector that is going to the rx input of the arduino?


Answer 8 months ago

thats easy. did this already, just convert the usbMidi rx to the serial midi


Question 1 year ago

if atmega328 cant do usb , how about native din 5?


Answer 10 months ago

I think it's possible, the source code uses MIDIUSB.h and constantly read for MIDI messages coming from the USB MIDI device and trigger noteOn() and noteOff() respectively. I think you can just replace that with a SoftSerial at 31250bps (the baudrate the traditional MIDI interface uses) and wire a 5 pin DIN port, since MIDI interface is in fact just opto-isolated UART. For this simple usage I don't think isolation is even needed.


Question 1 year ago

Decided to give this a try and have all parts but the audio jacks
ordered. I'm wanting to have the option of outputting all three analog
channels to separate output jacks and was wondering if it's as simple as
duplicating the output circuit for each output. is that the best way to
go about it?


Question 1 year ago on Step 4

I have purchased all the components and am preparing to build this (waiting for my chips to arrive from China). What technique did you use to make the wire connections? Did you loop the wire ends around the pins and leads and solder both together? Or did you solder all pins and leads to the board and then resolder the wires on top of them? I haven't used pcb prototyping boards very much (usually just pcb kits), so I'm unsure what the optimal procedure is here. Thanks for any help!


Answer 1 year ago

Solder the larger components first like the IC socket then on the other side solder everything together with wires or the rest of the component leads, yeah basically resolder


1 year ago

Good to hear, I'm building a new one (to test 10 Chinese clones to make sure they work, or just pure...) - will be using the Leonardo & a 40 pin ZIF socket (with other GLU logic/circuits for data lights, etc.).


Question 1 year ago on Step 7

I built this but I get a very low output with a lot of high pitched noise. Not sure what I did wrong

EDIT: Just want to thank everyone that got back to me on this, the advice helped me learn what was actually happening. In my ignorance, I didn't solder the capacitor to all of the ground pins are the Arduino, doing so fixed my problem. Now I know that we are using them to filter that noise.

Aric Caley
Aric Caley

2 years ago on Step 7

Pretty cool. I was thinking about doing something similar with one of the analog synth chips (TI SN76477) from way back, which I still have. I was designing a board for my Sinclair back then to use the AY-3-8910's but I never got hold of those chips (this was in the early 80's).