MIDI protocol originally used 5-pin DIN connectors. However, nowadays most MIDI devices support MIDI over USB.
USB is an asymmetrical protocol. On one side of the cable there's always a smart USB host while on the other side there's a USB device that is usually quite simple and dumb (I'm oversimplifying here and omitting USB OTG).
When you need to connect USB-based devices to DIN-based devices, it can be easy if on USB side there is a USB host (like a laptop). There's cheap USB-to-MIDI cables that can help with that. However, if you only have a USB device (like a keyboard), it needs to be connected to a USB host and a simple USB-to-MIDI cable cannot be used for that.
Commercially-available USB MIDI host devices are usually quite expensive for what they do ($100+). This project is an attempt to build a cheap DIY alternative by using Raspberry Pi Zero and a cheap Chinese USB hub.
Files
connect-midi scripts.zip
Scripts for setting up software on the Pi Zero:
* connect-midi.sh
* connect-midi-loop.sh
To test if these scripts work connect the USB hub using a USB OTG adapter to the Raspberry Pi. Run this command and then connect multiple MIDI devices to the USB hub to check if MIDI messages sent by one device are received by other devices:
/home/pi/Desktop/connect-midi-loop.sh
Finally, add this to the end of /etc/profile (it'll automatically start running connect-midi-loop.sh in the background when Pi Zero starts up):