Home » A $15 MIDI host

Beto Dealmeida's avatar

A $15 MIDI host

How to build a MIDI host for USB devices for $15

Approximate reading time: 2 minutes

Current weather: 5°C (Clear)

MIDI is an old protocol that allows music equipment to communicate with each other. The most common example is using a MIDI keyboard to play sounds on a computer. The MIDI keyboard, differently than a piano, sends only note information (pitch, velocity, duration, eg) to the computer, and the computer runs software that translates the MIDI information into sounds. The software running in the computer could translate the MIDI notes to piano sounds, allowing the MIDI keyboard to simulate a piano, but it could also produce any kind of sound or even control parameters in the software.

Initially MIDI used a connector called DIN5, but most of the recent gear supports MIDI over USB. This allows you to plug the MIDI device in your computer's USB port, and connect it to software without needed a dedicated MIDI port in your computer. These days a lot of the gear that comes with the DIN5 connectors also supports USB MIDI, since it's cheap and easy.

One problem that arises is interconnecting two devices via USB MIDI. For example, I have a MIDI drum pad controller that I can play with drumsticks, and it has a micro USB port to send the notes. I want to connect it to a sampler loaded with drum samples, so that hitting the drum pad controller produces drum noises. Both devices support USB MIDI, but I can't simply connect one to the other. In order to talk to each other one of them needs to be a MIDI host, which is basically a computer that serves as a host into devices can be connected.

You can buy MIDI hosts, but they are expensive — usually more than $50. In order to plug my drum pad into my sampler I decided to build my own, using a Raspberry Pi Zero and an OTG USB hub[archived]. I wrote a service that automatically connects all MIDI devices[archived], so that I can just plug my USB MIDI devices to the hub and they are automatically connected to each other. I used a USB hub that can be powered externally, and I was positively surprised to discover that it also powers the Raspberry Pi through the USB port! There's no need to plug the Raspi into power, which saves a cable and keeps the design compact:

I also configured the Raspi to have the file system mounted as read only[archived], to prevent it from being corrupted when I power it off.

All the parts can be bought for approximately $15. The Raspi Zero costs $5 ($10 if you want wifi, but it's not needed), and the USB hub can be bought for ~$10. You still need an SD card, but any spare one that you have in your house should work, and a micro USB cable to power the hub.

Comments

You can engage with this post on Twitter or Webmention.