- 1 year ago
How do I get Python to talk to the portmidi c library on Windows 11/64
To use the PortMidi library with Python on Windows 11/64, you can use the python-rtmidi
package which is a Python wrapper for the PortMidi library.
Here are the steps to install and use python-rtmidi
:
Install PortMidi: Download the PortMidi binary from the PortMidi website and install it on your system.
Install
python-rtmidi
: Open a command prompt or terminal window and run the following command to install thepython-rtmidi
package:pip install python-rtmidi
Test the installation: Run the following Python code to test if
python-rtmidi
is working correctly:goimport rtmidi
midi_in = rtmidi.MidiIn()
ports = midi_in.get_ports()
if ports:
print("MIDI ports available:")
for port in ports:
print(port)
else:
print("No MIDI ports available")
This code will attempt to access the MIDI ports on your system and print a list of available ports to the console. If you see a list of available ports, then
python-rtmidi
is working correctly.
Note that you may need to run your Python code with administrator privileges in order to access the MIDI ports on your system. To do this, right-click on the Python script or command prompt and select "Run as administrator".