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.3, 3.4, 3.5).

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-1.0.0rc1.zip (210.8 kB view details)

Uploaded Source

python-rtmidi-1.0.0rc1.tar.gz (185.1 kB view details)

Uploaded Source

python-rtmidi-1.0.0rc1.tar.bz2 (162.5 kB view details)

Uploaded Source

Built Distributions

python_rtmidi-1.0.0rc1-cp35-cp35m-win_amd64.whl (68.8 kB view details)

Uploaded CPython 3.5m Windows x86-64

python_rtmidi-1.0.0rc1-cp35-cp35m-win32.whl (61.2 kB view details)

Uploaded CPython 3.5m Windows x86

python_rtmidi-1.0.0rc1-cp34-cp34m-win_amd64.whl (68.5 kB view details)

Uploaded CPython 3.4m Windows x86-64

python_rtmidi-1.0.0rc1-cp34-cp34m-win32.whl (63.5 kB view details)

Uploaded CPython 3.4m Windows x86

python_rtmidi-1.0.0rc1-cp27-cp27m-win32.whl (57.4 kB view details)

Uploaded CPython 2.7m Windows x86

File details

Details for the file python-rtmidi-1.0.0rc1.zip.

File metadata

File hashes

Hashes for python-rtmidi-1.0.0rc1.zip
Algorithm Hash digest
SHA256 a044036e82198fb31a277148ededc4e67dcc89ea9161d65d50f8ed7404b787f4
MD5 f490ee1a6f8b8e83da3632fe42a203c3
BLAKE2b-256 70004245aedfa5d352cdb086b3a7f329e0446bd13995d2ef69fe3c2a46ca6cee

See more details on using hashes here.

File details

Details for the file python-rtmidi-1.0.0rc1.tar.gz.

File metadata

File hashes

Hashes for python-rtmidi-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 b832a309be453896e13fccc505ec83c67c40659d94e8791ea66322ca8d6cd561
MD5 b50dde03217d50cc094e99bb725a2304
BLAKE2b-256 6be467ed7214b8b2d4388c9f1029942192175774681ad1dce2cff745fb6803ec

See more details on using hashes here.

File details

Details for the file python-rtmidi-1.0.0rc1.tar.bz2.

File metadata

File hashes

Hashes for python-rtmidi-1.0.0rc1.tar.bz2
Algorithm Hash digest
SHA256 f1169242ce9b1da8a139684ddb65afe846b7931eaea11ab3fc6d91dfc90a4492
MD5 ffc38e0d59d47597d2957112a0d1e324
BLAKE2b-256 d9212e8d36dd0369440a446fffc41a57bfb847bec26e75b0adbd99f397c11191

See more details on using hashes here.

File details

Details for the file python_rtmidi-1.0.0rc1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for python_rtmidi-1.0.0rc1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 bf8f6897a03a9c25a7ff7eebc4e0c4eb325c0fa9ae0075722593d68f121da176
MD5 a12ffe7144516463008a19d040fce424
BLAKE2b-256 1f4133950be78dcea90be067b6ffa0d805748aed1eb0710c08c9cacb6c7b01ee

See more details on using hashes here.

File details

Details for the file python_rtmidi-1.0.0rc1-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for python_rtmidi-1.0.0rc1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 3cbc825824b65817b367432ef90206dd278ebe5f8c58c7067b82b39962dc09aa
MD5 1f7ac41b0ec19a93b3a5a3968508c15a
BLAKE2b-256 db9756681a497c9dff4afbe2274084ba93291187b24ceba3ba3cc52efd3457d5

See more details on using hashes here.

File details

Details for the file python_rtmidi-1.0.0rc1-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for python_rtmidi-1.0.0rc1-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 008306f2fe282c95b60990ef2c8b79da495978cc8d8161a407abf5e9ed2818e2
MD5 87c00b5c67d54330592a915deb98d716
BLAKE2b-256 0b40b8fa925c874b1e5be780001ffadfe492e93126536fba25d6f32954344384

See more details on using hashes here.

File details

Details for the file python_rtmidi-1.0.0rc1-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for python_rtmidi-1.0.0rc1-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 74442755d7516ed4c560d738465fe2f4fe955ae709d40a7d9b29a7ab36f34b59
MD5 b192aa7c082ba9f94168331da434a345
BLAKE2b-256 564fe96cbfe0291fb3cf0564ca0d7d7ee009acc31756c7f3a51afd7d1a7833d1

See more details on using hashes here.

File details

Details for the file python_rtmidi-1.0.0rc1-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for python_rtmidi-1.0.0rc1-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 d918a84103a0336d66cb927e542894de9a68b1e9c699b4dbe099719a0b896ff9
MD5 cfc1d04bfa0f67d41bdbc2a5183c9342
BLAKE2b-256 774252f31903115e7e01e4fd9719291cabc5af1f5ad7140053595840154b04f1

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