My goal:
I want to write a script on my Raspberry Pi Zero W, that sends MIDI to my computer whenever I make a specific connection on the GPIO board.
The problem:
The hardware stuff is already taken care of, it can recognize unique button presses. But it won't seem to send any data to my computer. I've tried multiple python modules (like rtmidi-python
, python-rtmidi
, mido
), but none of them work as I would want them to.
Trying to solve this issue, I've set up my Raspberry to power from the power port, so the USB port remains empty, and when it boots up, I connect the cable to my PC. I even wrote a script, that perpetually shouts the same note (note off included) over and over, since I couldn't find any "setup protocol". While browsing various forms, I noticed that all of them were pretty old. The newest is rtmidi-python
on GitHub, but that doesn't seem to have any setup stuff.
It very well could be, that i just looked the wrong way all along, or that the signal doesnt even come through the USB cable, or it doesn't need a setup either. If so, would you mind letting me know, or showing me how to do it correctly.
Update
I made my Raspberry into a "MIDI function" (this is how). My PC, and FL studio recognizes it as well. However, still no action, when I try to play a note. This port probing scripts
import rtmidi_python as rtmidi
midi_out = rtmidi.MidiOut()
for port_name in midi_out.ports:
print port_name
returns
Midi Through:0
f_midi:0
I can't decide wehter it says that no MIDI messages went through, or that my Raspberry is talking on Port0
Solution:
First, You've got to make sure, that your Raspberry Pi
is actually recognized as (in this case) a MIDI gadget
. Then, don't confuse Python
with Python3
, as they are different, and pip3 install mido
≠ pip install mido
. Also, a good practice, to keep your SD crad clean, and delete any unnecessary modules. If You're system gets really messy, and you loose track even with pip list
and apt list
(which lists all your installed modules), You can always start anew. Meaning wipe clean your SD card, and with the experience you've learned, it should be easier this time.
Also, you should obviously check out the given answer.
Hopefully at least one other person sees this, and I'm able to help them :)