Example with rtpMIDI - mik3y/pymidi GitHub Wiki
Example: Using with rtpMidi
Two parts, configuring the Windows end of rtpMIDI and then the pymidi end of whatever device you're running it, in my case a Raspberry Pi, which I've named on the network as "rpi-midi".
rtpMIDI on Windows
- Add a Session, give it a local name, a bonjour name and a port number. These can be anything on your Windows machine, I don't think you need the info for pymidi, as pymidi is the server and these details are for when rtpMIDI is the server I think. Then enable it by ticking the box.
- Under Directory, you have to manually add the server details (in my case the Raspberry Pi) running pymidi. Click the + box under Directory and fill in Name, Hostname / IP-Address and Port of the device running pymidi. In my case, Name=anything, Hostname=rpi-midi, Port=5004. You could use IP addresses here if you want.
- With this new entry in the Directory selected, click the Connect button underneath and it should now be added to the Participants box on the right of the rtpMIDI dialogue box.
pymidi setup
- Using the example code given for pymidi, all you need to do is run the code but include the port number you used in Step 2 above (in my example 5004) in the line:
myServer = server.Server([('0.0.0.0', 5004)])
Now you should see connection message appear in pymidi output, and on Windows under rtpMIDI, you should hopefully now see some value under latency.
To test, I just opened MIDI-OX, selected the MIDI port from the local name in the first step of the Windows setup, set MIDI-OX to use the keyboard for MIDI keys and hitting keys, you should see messages reported from pymidi.