RPi MIDI bridge

[Update: See Send MIDI from USB-B to 5-pin.]

Here’s a vexing problem that many electronic musicians face.

Let’s say that you own a lot of gear, some of which uses the old school 5-pin DIN MIDI interface. For example, there are a ton of classic (and not so classic) tone modules and keyboards that have 5-pin MIDI IN and MIDI OUT ports.

Then, you buy a new mobile MIDI controller which only does MIDI over USB through a USB B device port. The M-Audio Keystation Mini 32 is an example. This design covers the most common case — hooking the controller to a computer having a USB A host port — but you can’t connect the controller directly to the 5-pin MIDI IN port on one of your old tone modules or keyboards. USB ain’t RS-232 and class-compliant MIDI over USB has its own protocols, too. So, you can’t just whip up a simple cross-over cable or signal converter.

There are two commercial solutions to this problem: the Kenton USB MIDI host and the iConnectivity iConnectMIDI4+. Neither of these solutions is cheap and they cost more than a lot of MIDI controllers themselves!

Some people on the web have suggested an Arduino-based solution. However, here’s an easy riddle. What super low cost single-board computer has two USB host ports? Answer: The Raspberry Pi Model B.

The RPi Model B seems like a natural for this problem. It’s inexpensive, it has the necessary ports, and there are plenty of rugged cases available. Musicians will want to use this solution at the gig, so a good case is essential. There are two issues. First, the RPi can source only a limited amount of power to a USB device. Some MIDI controllers may draw too much current. Second, musicians don’t like to haul extra gear to a gig, so they won’t want to take a display and keyboard to a gig just to boot the RPi and run the software needed to bridge the two USB A ports. The solution must be stand-alone, plug-and-play, and consist only of the RPi itself, a power source, and a few cables.

Here’s what I have in mind for the hardware. The MIDI controller is connected to the RPi using a standard USB A to USB B cable. The MIDI controller draws power from the RPi. Some MIDI controllers have a dedicated power supply jack and in that case, a separate power adapter for the MIDI controller seems prudent. The other USB host port on the RPi is connected to an inexpensive commercial USB to 5-pin MIDI interface — the kind used to connect 5-pin equipment to computers. The commercial interface should be MIDI class-compliant and should not require special drivers. Knowing the state of the world such as it is, you may not easily find proprietary Linux drivers for the interface. The commercial MIDI interface provides the connection to the 5-pin DIN MIDI ports on your old piece of gear.

Musicians usually have an old USB MIDI interface like the Edirol/Roland UM-2EX in the studio. These interfaces are readily available at very low cost on the web for not much more dosh than a cable. This approach doesn’t require custom hardware or shields like an Arduino-based solution.

Here’s what I have in mind for the software. Folks already bridge PC MIDI ports using MIDI-OX. Linux has the ALSA MIDI software. The amidi -l command displays the physical and virtual MIDI ports. The aconnect command connects MIDI ports. The trick will be discovering and connecting MIDI ports after boot without manual intervention, i.e., the RPi boots and builds the bridge without a keyboard, display, a log in, etc.

So, there it is! My hardware lab is currently in disarray so I can’t easily do a proof of concept implementation. However, if you have the RPi and the pieces/parts, please give this a try.

If you enjoyed reading this article, you may find these articles interesting, too: