skip to navigation
skip to content

Not Logged In

python-rtmidi 0.4.3b1

A Python wrapper for the RtMidi C++ library written with Cython.

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), Macintosh OS X (CoreMIDI & JACK), and Windows (Multimedia Library & Kernel Streaming) operating systems.

python-rtmidi is a Python binding for RtMidi implemented with 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.3).

Note

python-rtmidi is currently in beta-stage, which means is is published in the hope that other developers try it out and help finding bugs, and that its API is not yet finalised. What is there should work but is currently only tested thoroughly under Linux ALSA/JACK and less regularly under OS X (CoreMIDI/JACK) and Windows (WinMM).

Support for the Windows Kernel Streaming API is currently broken in RtMidi.

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 tests and examples directory of the source distribution. API documentation is available by looking at the docstrings in the Cython source code src/_rtmidi.pyx or using tools like pydoc or IPython and by reading the (somewhat terse and inaccurate) RtMidi documentation.

 
File Type Py Version Uploaded on Size
python-rtmidi-0.4.3b1.tar.bz2 (md5) Source 2013-11-10 96KB
python-rtmidi-0.4.3b1.tar.gz (md5) Source 2013-11-10 119KB
python-rtmidi-0.4.3b1.win32-py2.7.exe (md5) MS Windows installer 2.7 2013-11-10 291KB
python-rtmidi-0.4.3b1.win32-py3.3.exe (md5) MS Windows installer 3.3 2013-11-10 289KB
python-rtmidi-0.4.3b1.zip (md5) Source 2013-11-10 138KB
python_rtmidi-0.4.3b1-py2.7-macosx-10.6-intel.egg (md5) Python Egg 2.7 2013-11-10 171KB
python_rtmidi-0.4.3b1-py3.3-macosx-10.6-intel.egg (md5) Python Egg 3.3 2013-11-10 172KB
  • Downloads (All Versions):
  • 75 downloads in the last day
  • 725 downloads in the last week
  • 3352 downloads in the last month