MIDI over LAN
The audio/video studio of the University of Ilmenau needed a way to transport MIDI over a greater distance than the 10m which are usually possible with MIDI. They wanted to do this over LAN. Me and a a fellow student needed a topic for our "Media Project", which was mandatory. He is the software guy, I am the hardware guy, lets go.
Has anyone tried this yet? Are working solutions available? Are there suggestions how to solve this? This was in 2005, so Ableton Link, Bluetooth MIDI and all the other options we have today in 2021 were not available. We found quite a few points where we could start with:
- You could use two Apple computers and 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.
- A promising approach 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.
We were very surprised (in a positive way) when we found the Ethernut project. On the software side it consists 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, get the schematics and the layout files and can use them free in your own designs. Exactly what we needed.
So we ordered two PCBs. Ethernut 1.3 was enough. The port pins were available through a big header, so I added a daughter PCB containing a display, one MIDI-IN and one MIDI-OUT-Port and a 4x4 keypad, in case we had to enter an IP-Address. So much for the hardware.
The software routed every MIDI-byte from the MIDI-IN directly to the LAN using UDP. So no precautions were made if a LAN packet got lost. We decided to go for this approach because the use case would be in the LAN of the University which should not be plaqued by packet loss. It was a bit risky, if you would loose a NOTE-OFF-byte you would be stuck with a permanent sounding tone.
We also implemented an option to choose between speed and traffic. You can set up how many MIDI-bytes will be gathered before the packet is being sent. Also we implemented a timeout how long the firmware should wait for MIDI-bytes.
But it worked pretty good. As a worst case scenario we were able to program a Clavia Micro Modular over LAN. This synth is a virtual modular system and relies on heavy SysEx-Traffic to synchronize the patches between the PC and the unit.
- 2021/06/23 - Revision of the text, updating text and links.