USB-MIDI Gadget improvements on Linux

Here at ROLI we make heavy usage of Linux and its audio stack (ALSA). And one of our problems was the MIDI Gadget driver. The Linux USB Gadget MIDI driver has been neglected for few years now. It had several bugs, memory leaks and not very clean code-base. Why didn’t anyone care? Well, one of the reasons is that MIDI is a low speed and low throughput protocol, and the current driver was delivering just enough. But that is about to change because ROLI and others have been working on the Multidimensional Polyphonic Expression (MPE) MIDI specification, which increases dramatically the number of MIDI messages per second and per USB request. Thus problems started to arise.

Overall there were several patches that we upstreamed, including performance and memory-footprint improvements by pre-allocating IN USB requests, state machine refactor and fixing an annoying bug that caused the MIDI Streaming endpoint to freeze. There were also critical memory leaks fixes in ChipIdea’s UDC driver.

It is important to note that the Linux community was very helpful and open as always. Our threads created some helpful discussions and motivated others to contribute and improve the MIDI driver too.

So, update your kernel to v4.5 and enjoy a much better MIDI experience for your device on Linux.

PS: v4.6 and v4.7 will also have other improvements that were not merged yet.