Registry / communication / python-rtmidi

python-rtmidi

JSON →
library1.5.8pypypi✓ verified 34d ago

Python bindings for the RtMidi C++ library, providing real-time MIDI input/output using Cython. Current version 1.5.8, updates irregularly.

communication
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Old import path from version <1.0

from rtmidi import MidiIn

Old import path from version <1.0

from rtmidi import MidiOut

Basic setup: list ports, open input, set callback.

from rtmidi import MidiIn, MidiOut # List available ports midi_in = MidiIn() print('Input ports:', midi_in.get_ports()) midi_out = MidiOut() print('Output ports:', midi_out.get_ports()) # Open first port and listen if midi_in.get_ports(): midi_in.open_port(0) # Callback example def callback(message, data): print(message) midi_in.set_callback(callback) import time time.sleep(2) midi_in.close_port() else: print('No MIDI input ports found.')
Debug
Known footguns
breakingIn version 1.5.8, Linux wheels no longer bundle libasound. If ALSA is not installed, the module will fail to load.
gotchaMidiIn and MidiOut objects are not thread-safe. Do not call methods from multiple threads without external locking.
gotchaOn macOS, the library defaults to CoreMIDI but can be built with JACK. Ensure you have the correct backend installed.
deprecatedThe `midiutils` module is deprecated and may be removed in a future version.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources