title: Can't communicate midi through USB (python)
body: <h3>My goal:</h3>
  <p>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.</p>
  <h3>The problem:</h3>
  <p>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 <code>rtmidi-python</code>, <code>python-rtmidi</code>, <code>mido</code>), but none of them work as I would want them to.</p>
  <p>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 &quot;setup protocol&quot;. While browsing various forms, I noticed that all of them were pretty old. The newest is <code>rtmidi-python</code> on GitHub, but that doesn't seem to have any setup stuff.</p>
  <p>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.</p>
  <h1>Update</h1>
  <p>I made my Raspberry into a &quot;MIDI function&quot; (<a href="https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget" rel="nofollow noreferrer">this is how</a>). My PC, and FL studio recognizes it as well. However, still no action, when I try to play a note. This port probing scripts</p>
  <pre><code>import rtmidi_python as rtmidi
  
  midi_out = rtmidi.MidiOut()
  for port_name in midi_out.ports:
      print port_name
  </code></pre>
  <p>returns</p>
  <pre><code>Midi Through:0
  f_midi:0
  </code></pre>
  <p>I can't decide wehter it says that no MIDI messages went through, or that my Raspberry is talking on Port0</p>
  <h1>Solution:</h1>
  <p>First, You've got to make sure, that your <code>Raspberry Pi</code> is actually recognized as (in this case) a <code>MIDI gadget</code>. Then, don't confuse <code>Python</code> with <code>Python3</code>, as they are different, and <code>pip3 install mido</code> ≠ <code>pip install mido</code>. 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 <code>pip list</code> and <code>apt list</code> (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.</p>
  <p>Also, you should obviously check out the given answer.</p>
  <p>Hopefully at least one other person sees this, and I'm able to help them :)</p>
  <h2>Thanks</h2>