One of our customers brought to our attention an implementation of RTP MIDI for Arduino. With this sketch, you can use an Arduino to send and receive MIDI over Ethernet and WiFi. It is compatible with McLaren Labs’ rtpmidi, so you can use it to send MIDI from an Arduino to your Raspberry Pi.
Have you ever wanted to use MIDI commands to control electrical lights or appliances? This article will tell you how using a Raspberry Pi, the GPIO pins controlled by some open-source software from McLaren Labs on GitHub, and a nifty device called the IOT Relay. Using the Relay is an affordable and SAFE way to control 120 VAC sockets and it makes this project a breeze.
In version 0.5.2 of McLaren Labs’ rtpmidi, we made the use of locked memory the default. Locked memory dedicates fixed RAM to the rtpmidi process, and prevents it from being swapped to disk. The use of locked memory (through the mlockall() function call) can be a benefit to realtime applications like MIDI and Audio, but its use can be to the detriment of other processes. So it should be used carefully.
On Ubuntu 18.04 and 20.04 enabling memlock as the default option seemed benign enough. On Ubuntu 20.10, however, this default caused problems. With memlock enabled, the process printed strange errors and aborted. Example:
Ubuntu 20.10 (Groovy Gorilla) accounts for locked memory pages differently, and even though the memory limit is higher, with all things accounted for, it is not enough.
When you use our rtpmidi tool to connect two devices you have created a “session.” The session has an “initiator” side that started the connection, and “listener” side that accepted the invitation. Some devices, however, do not make good “initiators” and iPhones are a great example. An iPhone cannot initiate a network MIDI session.
But sometimes you want an iPhone to join the MIDI network of a stationary computer … without going back to the computer screen. McLaren Labs’ “favorite” option was created to handle this case.
A “favorite” is the name of a device that that rtpmidi automatically initiates a session with whenever the favorite appears on the network. This new feature takes advantage of the properties of Bonjour (Avahi). A Listener advertises its availability using Bonjour. When rtpmidi detects a Bonjour name matching a favorite, it automatically initiates a session with that name.
Use the “favorite” option from the command line like this.
$ rtpmidi gui -F 'myiPhone' -t Organ-Synth:0
Now, whenever rtpmidi sees the iPhone named “myiPhone” it will automatically call it and route MIDI information to “Organ-Synth”.
A service is a program that the operating system automatically starts when it boots. On the Raspberry Pi “buster” operating system, the daemon that starts and stops services is called “systemd.” You can read about creating services here:
McLaren Labs rtpmidi can be run as a service so that whenever you start your Raspberry Pi rtpmidi can be ready to go. This is especially useful in a headless system where you want rtpmidi to route incoming RTP MIDI sessions to a specific MIDI destination.
One of our customers wanted to know how to do this, so we wrote up this HOWTO guide. Here we will show how to create a service that
This month McLaren Labs releases rtpmidi version 0.5.0 for Ubuntu and Raspberry Pi. This release brings some great new features, and also provides a few performance and installation improvements.
More MIDI message types … including SysEx
McLaren Labs rtpmidi has always supported the following message types with full Journal capability for sending and receiving. (Note: The Journal is part of the error correction mechanism that recovers lost messages that occur when sent over a network.)
Note On, Note Off
Control Change
Program Change
Pitchwheel
System Reset
With this release, we also add the following to provide a complete set of MIDI message types including System Exclusive.
Network MIDI was invented sometime around 2004 to send MIDI messages over an IP network. To handle network loss, a protocol known as RTP-MIDI was created and documented as RFC-4695. Network MIDI is built into OSX computers and iOS devices. Apple music creators think nothing of connecting MIDI equipment using Ethernet and WiFi, instead of MIDI cables.
Sometime around 2009, Network MIDI was built into iPads and iPhones. This made building touch-based control surface Apps easy, and ensured they integrated with MIDI Workstations over WiFi. While this capability created many cool demos, the unpredictable latency and jitter of WiFi made MIDI-over-WiFi not attractive where timing is important. MIDI-over-Bluetooth became a standard in the last few years, and seems to be the preferred method for sending MIDI over wireless links.
But Network MIDI persists, and new implementations of the protocol as software pop up, as do new hardware products implementing the protocol. This article is a round-up of some of the implementations available in 2019.