A Python binding for the RtMidi C++ library implemented using Cython.
Project description
RtMidi is a set of C++ classes which provides a concise and simple, cross-platform API (Application Programming Interface) for realtime MIDI input / output across Linux (ALSA & JACK), macOS / OS X (CoreMIDI & JACK), and Windows (MultiMedia Library) operating systems.
python-rtmidi is a Python binding for RtMidi implemented using Cython and provides a thin wrapper around the RtMidi C++ interface. The API is basically the same as the C++ one but with the naming scheme of classes, methods and parameters adapted to the Python PEP-8 conventions and requirements of the Python package naming structure. python-rtmidi supports Python 2 (tested with Python 2.7) and Python 3 (3.4, 3.5, 3.6 and 3.7).
Usage example
Here’s a quick example of how to use python-rtmidi to open the first available MIDI output port and send a middle C note on MIDI channel 1:
import time import rtmidi midiout = rtmidi.MidiOut() available_ports = midiout.get_ports() if available_ports: midiout.open_port(0) else: midiout.open_virtual_port("My virtual output") note_on = [0x90, 60, 112] # channel 1, middle C, velocity 112 note_off = [0x80, 60, 0] midiout.send_message(note_on) time.sleep(0.5) midiout.send_message(note_off) del midiout
More usage examples can be found in the examples and tests directories of the source repository.
The documentation provides installation instructions, a history of changes per release and an API reference.
See the file LICENSE.txt about copyright and usage terms.
For more information, visit https://chrisarndt.de/projects/python-rtmidi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for python_rtmidi-1.2.0rc2-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b7cdefbf97d7104a2188e4afc2fce769fee39a6862867be459134c21e7b4de2 |
|
MD5 | 785929a32887ca1ea1f49c70d92a5427 |
|
BLAKE2b-256 | 2a74515370364cab8b57011943171ac00fcec8dd6d203a7fe1b75ae56a0ca790 |
Hashes for python_rtmidi-1.2.0rc2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b4476eb334fec86664055cf16f062b54a9e33889865051d62020442e77dd3e1 |
|
MD5 | c818213bcc1391a3a1aeaa602dbfc6b2 |
|
BLAKE2b-256 | 75b7edfa537c8a9f4ce56120b39aa676627129b693cc0e8a598ed2cdb4f46cb3 |
Hashes for python_rtmidi-1.2.0rc2-cp27-cp27m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f349cb359615a0e265bfb8157dbab3ea64a39baedef2d40adea13331c2eaa9 |
|
MD5 | 12e5602b734486ba403468f3a6c9e13a |
|
BLAKE2b-256 | 5108c03536fbdaa2c5ea6bb3f02a97b7ffd582d2d3cbc8b8352a3eb2093375ce |