Receiving MIDI on a Raspberry PI
This is another MIDI related post, but this time a Raspberry Pi and some LEDs are involved as well.
The result of my previous MIDI experiments was MIDI Aid for Mac and MIDI Aid for iPad, iPhone and iPod touch. Those apps are perfect for understanding what a controller sends to your Mac OS or iOS device. I have explained the theory of how MIDI messages look like already in [this post]({% post_url 2016-01-19-anatomy-of-midi-message %}).
The objective this time was to send MIDI to a Rasperry Pi to control some LEDs. In specific, when hitting the middle C a green LED should light up, when hitting the D next to it a yellow LED and then a red LED when the E gets pressed.
Please note, that the MIDI controller is directly connected via USB and not the standard DIN 5-pin.
Of course someone else on the internet already had a similar task and thankfully blogged about it. This was my starting point.
First I have wired up everything.
Then changed the code to meet my objective
{% gist db20d8dade08e7f04787 hello-midi.py %}
Of course, this can be easily extended for more keys and LEDs or whatever you want to accomplish with your MIDI controller.
Finally, I took a little video of how it is working:
Done for today!