You are here: MIDI over LAN

MIDI over LAN

Background

For my studies of Media Technologies at the Technical University of Ilmenau it was mandatory to have a so called ā€˛Media Project". This is a project which is roughly based around a media topic. We did this project in 2005.

Because I am interested in hardware development and found a friend who is a specialist in software, we were searching together for a project and found a very interesting one in our university.

The audio- and videostudio of our university needed a way to establish a MIDI communication over a long distance. Much longer than the 10m you can possibly stretch a MIDI cable and hope that the system still works. So they thought about using the already available LAN infrastructure for this purpose. And hell yeah, this sounded really cool.

Research

The first thoughts are of course: Has anyone tried this yet? Are working solutions already available? Are there suggestions how to solve this? And yes, we found quite a few points where we could start with:

  • You can use two Apple computers and use the internal MIDI Ports of OSX and route them over the LAN. This solution is a bit overpowered and expensive for the university and no real challenge for us promising students.
  • There exist a bunch of ideas of how to transmit audio over ethernet. Some of them transmit MIDI too, MLAN for example. But this solution was overpowered as well.
  • dmidi sounded promising, but was at the time of research only available as a web archive. You shouldn't rely on such a thing.
  • A promising and solid suggestion was RTPMIDI by John Lazarro and John Wawrzynek. They tried to squeeze MIDI into the Real Time Protocol (RTP) and had a lot of backup and security so no data could get lost.
  • But we did, what a lot of companies are doing, unfortunately: We made our own protocol. Even if RTPMIDI sounded very promising, we wanted to realize everything using embedded hardware. The 8 bit Atmega processor we thought of was not able of handling the protocol overhead and the needed huge buffers. Which brings me to..

Hardware, Software and Implementation

We were very surprised (in a positive way) as we found the Ethernut project. It consists on the software side of two components:

  • NUT/OS is a realtime operating system running on 8 bit atmel processors.
  • NUT/NET is a complete TCP/IP stack running on NUT/OS.

The software runs on various hardwaredesigns, which you can buy from a company called Egnite for reasonable prices. You can choose the evalboard which suits your needs. And the best: You get the schematics and layout as well and can use them free in your own designs. Incredible and exactly what we needed.

So we ordered two of these boards, Ethernut 1.3 was enough. The port pins were available through a big header, so we could add a display, the MIDI-Ports (1 IN, 1 OUT) and a 4x4 keypad. So much for the hardware. At this time our babys had their names: MIDINut.

The software was kept simple: We routed every packet from the MIDI IN directly to the LAN using TCP. The MIDI data could get stuffed together into an ethernet packet if a lot of MIDI data arrived at once. You can set up how many packets will be gathered before the packet is sent. This optimizes speed vs. bandwith usage. You have a "timeout setting" as well, so you can set up how long the software will wait for another MIDI datum to arrive before it gets sent.

These things worked perfectly! The thing I was very proud of was the programming of an Clavia Micro Modular synthesizer via MIDI. Those of you who know this synth can imagine, which stress is on the MIDI line if the synthesizer is in programming mode. But it worked, no data was lost and the transmission was fast enought as well.