Search SpikenzieLabs:

Serial - MIDI Converter


The Serial - MIDI converter (SM = Serial MIDI Converter) is a software solution to get your computer’s serial port (or virtual serial port over USB) talking with your MIDI software and hardware.

Normally, to use an Arduino or other micro-controller with your MIDI software you had to build a MIDI-in and MIDI-out circuit with a few parts and an opto-coupler. Easy enough, but then you would typically need a MIDI to USB adaptor to connect it to your computer.

With the SM and a board like you the Arduino with USB, you don’t need any other hardware to get your Arduino to play music with software such as Apple’s GarageBand or Ableton’s Live !

What it does:

Once the SM is configured it will;

  1. 1.Take “MIDI” incoming serial data and forward it to the desired MIDI port.

  2. 2.Take MIDI data coming from the chosen MIDI port and forward it out of the serial port.

What can you do with it;

  1. 1.Build a drum machine

  2. 2.Build a keyboard

  3. 3.Build a completely new type of musical instrument

  4. 4.Make a score that controls bells and tapping solenoids

  5. 5.Make a score that flashes lights and triggers special effects

  6. 6.Send data from your existing MIDI controller out to a serial device

  7. 7. etc ...

The MIDI-IN and MIDI-Out ports do not have to be same. For example, lets say you have an Arduino connected to sensors and visual effects, an external MIDI keyboard and Ableton Live software. You could send the Arduino’s sensor data to Live to play sounds and at the same time you could have the keyboards MIDI input routed back to the Arduino to activate visual effects !

How to use it: All Platforms

The SM is basically a traffic cop, you know the type that would direct traffic in an intersection with white gloves ...

Launch the SM and follow along with these steps.

Step 1. Choose a serial port.

This is the serial port that will be used for both serial TX and RX. Your micro-controllers serial port must be set to 57600 bps 8N1. (Even though MIDI is transmitted at 31250 bps, the serial port is set at a faster baud rate to help minimize any lag time.)

Step 2. Choose a MIDI-in port.

This is the source of MIDI data that will be sent out of the serial port. This can be a little confusing, if you are using audio software this will be the MIDI-out of the software ! If you are using an external controller like a keyboard, this will be the MIDI-in port from that device.

Step 3. Choose a MIDI-out port.

When the SM receives serial data it will pass the data out of this MIDI port. You will most often choose the port that your audio software uses as input, but you could also choose another MIDI device.

Done. You are now ready for some fun.

The SM must be running to direct MIDI to and from serial ports. So, just let it run in the background.

NOTE: If you are using SM with an Arduino, you must quit SM before you can upload a new sketch to the Arduino. This is because, as long as the SM is running it will keep the serial port open and this will make it unavailable to other programs, like the Arduino IDE.

A little bit about MIDI:

MIDI (Musical Instrument Digital Interface) uses a form of serial to communicate at a data rate of 31250 bps with each byte made of 8 bits plus a stop and start bit. MIDI commands are most often three bytes in length but sometimes more or less. The Serial-MIDI converter currently only handles three byte MIDI commands.

The first byte is called the Status byte and contains both the type of MIDI command and the channel number. The high nibble of this byte tells the MIDI device what it is doing, such as Note Off, Note ON, Control change etc... The low nibble is the channel, it is used to differentiate between devices that are on the same MIDI bus and varies from 0 to 15.

The second byte is the Pitch byte and is simply the note being played, stopped, altered etc... This byte is in the range of zero to 127.

The third byte (when used with Note-On or Note-Off) is the velocity, which is a form of volume for the note being played. Imagine that you hit a drum softly, then the velocity would be a low number, but if you really whaled on it then the velocity would be higher. This byte is also in the range of zero to 127.

Set-up for Mac OS X:

Using the SM on the Mac is easy, but the set-up takes a few steps. To use it you just double click the SM icon, then follow the instructions; choose a serial port, MIDI-in port and then a MIDI-Out port.

To set it up you will need two other pieces of software.

  1. 1.Apple’s Audio MIDI Setup (comes with your OS, in your Applications folder / Utilities )

  2. 2.mmj - Mac OS X universal binary java MIDI subsystem. Download from

mmj is needed since as of Mac OS 10.4.8 Apple no longer supports some java MIDI packages.


  1. 1.Download mmj and copy both mmj.jar and libmmj.jnilib into /Library/Java/Extensions.

  2. 2.Launch Audio MIDI Setup, then double click on the IAC Driver.

3. Now in the IAC driver, click the “More Information” triangle if it is not showing already.

Set-up Windows:

For the SM to work on a Windows machine you will also need other software to create a “virtual” MIDI port.

Download MIDI Yoke from MIDI-OX: MIDI Yoke

After installing MIDI Yoke, I recommend going into Control Panel and changing the default number of ports from 8 to 2. (With eight extra MIDI ports the SM interface gets too full (10 max). You will need to reboot after changing the number of ports.

  1. 4.In the lower left; double click the MIDI port name to edit it and click the + to add a new port. Your screen will not say “Output to Audio Software”, this is just the name I gave it. You can give them any name you want. I also added a second MIDI port so as to not conflict with the first one. You can try this or different combinations.

  2. 5.Important, check the “Device is online” box or nothing will work!

  3. 6.Click “Apply”, and now you are done. You may quit the Audio MIDI Setup software, it does not need to be running for the SM to work.


The objective of this project is to allow everyone that has a micro-controller of some kind be it an Arduino, PIC, Basic Stamp etc... to have access to MIDI without the need to make a hardware MIDI interface and then buy a MIDI to USB interface.

It is intended to be used with simple projects for fun and is not a full substitute for a hardware solution.

Know limitations;

  1. 1.MIDI messages coming from the MIDI-in port are limited to Note-ON, Note-OFF and Controller change commands.

  2. 2.The SM only supports MIDI messages which are three bytes in length.

  3. 3.Lag times may be too long for some uses approximately 26ms (see below).

MIDI message are often three bytes long. Note: The first byte, the Status byte is different from the other bytes since the MSB (the 8th bit) is always set and it is never set in the other bytes. This is so the MIDI devices can tell whether it is receiving data or a command.

Typical MIDI Message:

Screen shot of the Serial MIDI Converter. In this example the converter is set-up and running, with the summary of chosen ports displayed.

Screen shot from oscilloscope, showing delay from sending serial MIDI formated message to start of audio playing. This test was done with an Arduino sending out a NOTE-ON at 57600bps via the SM to GarageBand (on MBP 2.2ghz Intel Core 2 Duo). The NOTE-ON was sent at the mid point of the blip on channel 1. (It is actually two 5ms pulses close together, one right before the message was sent and another as soon as it was sent.) Channel 1 was connected to one of the Arduino’s digital pins and channel 2 was connected to an audio cable coming from the audio-out jack of the computer.

Illustration of how the data flows to and from the serial ports and MIDI.

Serial - MIDI Converter: (older version)

Demo Arduino Sketch:

(Demo sketch to play notes from middle C in the 4th octave up to B in the 5th octave and then back down)

What is this software made of ? - brief:

The Serial MIDI Converter was programmed in Processing 0135 Beta. It uses two key libraries to do what it does, the Processing Serial Library from the processing web site and themidibus by Severin Smith.

In case you want to see “under the hood”, the un-compiled Processing sketch is included with downloads.


Serial - MIDI Converter: v2c

Version: v2C


  1. 1.Selectable serial baud rate

  2. 2.Longer list for the serial and MIDI ports


Serial - MIDI Converter: v2d

Version: v2D


  1. 1.Updated compatibility with newer version of Java

Important update for Mac OS X:

Apple has released a Java update the reintegrates native MIDI support into the Java. This means that as of Apple’s Java 6 update, you will no longer require mmj.jar and libmmj.jnilib.

1. To use the Serial MIDI Converter version 2D or later, you have to have 10.5.x with the Java for Mac OS X Update 6. (To see if it is installed, you can go into the Software Update in system preferences and click on the Installed Updates tab or just keep doing software updates until there are no more.)

2. REMOVE: both mmj.jar and libmmj.jnilib from /Library/Java/Extensions. (These are no longer needed and cause a bug with the Java Update 6.)

  1. 3.Restart and follow the regular Serial MIDI instructions.





How To + Info