Skip to main content

A Python wrapper for the RtMidi C++ library written with 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), Macintosh OS X (CoreMIDI & JACK), and Windows (MultiMedia Library) 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.2, 3.3).

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

python-rtmidi-0.5b1.zip (197.5 kB view details)

Uploaded Source

python-rtmidi-0.5b1.tar.gz (174.3 kB view details)

Uploaded Source

python-rtmidi-0.5b1.tar.bz2 (152.4 kB view details)

Uploaded Source

File details

Details for the file python-rtmidi-0.5b1.zip.

File metadata

  • Download URL: python-rtmidi-0.5b1.zip
  • Upload date:
  • Size: 197.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-rtmidi-0.5b1.zip
Algorithm Hash digest
SHA256 2b6f6fdd4647da83e6b3476c630254d93d16de0c383940ed90b6724918c57ca3
MD5 dba5808d78c843254455efb147fe87b2
BLAKE2b-256 6f39f7f52c432d4dd95d27703608af11818d99db0b2163cec88958efcf7c10cf

See more details on using hashes here.

File details

Details for the file python-rtmidi-0.5b1.tar.gz.

File metadata

File hashes

Hashes for python-rtmidi-0.5b1.tar.gz
Algorithm Hash digest
SHA256 293f1086229bd07c9d59a53cc5b0f54491513322c30e25311c441187e2f397c8
MD5 ae206010645be579c75e513e708529b3
BLAKE2b-256 b12acef627dd6b5e7d4e25b41689eb6873787826ddcf60daac0bc66fa043c29e

See more details on using hashes here.

File details

Details for the file python-rtmidi-0.5b1.tar.bz2.

File metadata

File hashes

Hashes for python-rtmidi-0.5b1.tar.bz2
Algorithm Hash digest
SHA256 4075dea2a6da3087199a20817712cc6fc859a8947042b34d44302a5afc152272
MD5 d57dfbd85cc85cc2c72ee0b97f12b0f8
BLAKE2b-256 8bea791c3c72b21c87ca84c5ba65e33db27edfbdebc2ed8df59ef2561be2ab47

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page