While MIDI is serial communication, it is a standardized protocol and is treated differently by most operating systems. But because it’s just serial data, it’s possible to “re-route” these MIDI messages to a generic serial device like an Arduino using two small pieces of software.
This is something I figured out while working on the musical floppy drive project. For testing purposes, it was quicker and easier to send data via serial than it was to configure one of the Arduinos as a dedicated MIDI device.
You’ll need two pieces of software to make this work: loopMIDI and Hairless MIDI to Serial Bridge.
Digital Audio Workstation (DAW) software isn’t built to do this out of the box. First, it needs a MIDI device to send data to. That’s where loopMIDI comes in.
loopMIDI by Tobias Erichsen is a program that enables you to create virtual MIDI ports on your PC. You can download the latest version, as of this post’s writing, here. With a virtual MIDI port, you now have an address to send MIDI messages to from your program of choice.
After installation, start the program and create a virtual port (the name doesn’t matter). In your DAW, select the newly created port as either a MIDI input or output and you’re ready to go.
Be aware that each port is simultaneously a virtual IN and a virtual OUT, so messages pushed through to output will show up as input (it’s a loop!). If you need to do simultaneous input and output via serial, create two virtual loopMIDI ports.
Hairless doesn’t need to be installed on Windows, so extract the download and launch the program. The data direction arrows make setup a snap: select the MIDI ports going into and out of the serial device, and select your serial port. You can configure the serial baud rate in the Hairless preferences under the ‘File’ menu.
Again: Because the virtual ports in “loopMIDI” are shared between in and out, if you want to simultaneously send and receive you should create two separate virtual ports.
That’s it! With both loopMIDI and Hairless running, try sending some messages from your serial device or your DAW of choice. You should see the loopMIDI data counter increment and the individual messages display in the Hairless debug window.
If you’re having trouble, check the data indicators in both programs to make sure data is flowing. Also double-check that your baud rate in Hairless is set properly for your device, and that you’re connecting to the correct serial port. Note that if you change MIDI ports while transmitting you will need to disable and then re-enable the serial bridge (the checkbox in the upper-left).
For more information about properly formatted MIDI messages, I recommend reading this tutorial.