rtmidi2
Python wrapper for RtMidi, the lightweight, cross-platform MIDI I/O library. For Linux, Mac OS X and Windows.
Based on rtmidi-python, uses rtmidi version 6.0
Installation
pip install rtmidi2
This module is compatible with Python 3 >= 3.10
Documentation
Usage Examples
rtmidi2 uses a very similar API as RtMidi
Print all in and out ports
import rtmidi2
print(rtmidi2.get_in_ports())
print(rtmidi2.get_out_ports())
Send messages
import rtmidi2
midi_out = rtmidi2.MidiOut()
# open the first available port
midi_out.open_port(0)
# send C3 with vel. 100 on channel 1
midi_out.send_noteon(0, 48, 100)
Get incoming messages - blocking interface
import time
midi_in = rtmidi.MidiIn()
midi_in.open_port(0)
while True:
message = midi_in.get_message()
if message:
print(message, midi_in.deltatime)
else:
time.sleep(0.01)
Get incoming messages using a callback – non blocking
def callback(message, time_stamp):
print(message, time_stamp)
midi_in = rtmidi2.MidiIn()
midi_in.callback = callback
midi_in.open_port(0)
Open multiple ports at once
# get messages from all available ports
midi_in = MidiInMulti()
midi_in.open_ports("*")
def callback(msg, timestamp):
msgtype, channel = splitchannel(msg[0])
print(msgtype2str(msgtype), msg[1], msg[2])
midi_in.callback = callback
You can also get the device which generated the event by changing your callback to:
def callback(src, msg, timestamp):
# src will hold the name of the device
print("got message from", src)
Send multiple notes at once
# send a cluster of ALL notes with a duration of 1 second
midi_out = MidiOut()
midi_out.open_port()
notes = range(127)
velocities = [90] * len(notes)
midi_out.send_noteon_many(0, notes, velocities)
time.sleep(1)
midi_out.send_noteon_many(0, notes, [0] * len(notes))
Validation and error handling
The send_* methods validate their arguments and raise ValueError or TypeError on out-of-range values (channel 0-15, data bytes 0-127, pitchbend 0-16383, sysex data 0-127) instead of silently truncating or ignoring them. send_messages(messagetype, messages) combines messagetype | channel for each (channel, value1, value2) triple. send_noteon_many / send_noteoff_many accept lists, tuples or ranges. MidiIn.get_message() returns a list of ints or None when the queue is empty (use midi_in.deltatime for the timestamp); MidiOut.send_message accepts a list/tuple of ints.
License
rtmidi2 is licensed under the MIT License, see LICENSE.
It uses RtMidi, licensed under a modified MIT License, see RtMidi/RtMidi.h.
Metadata
Release files for rtmidi2 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 27.0 MB
Release files / rtmidi2-1.5.0-cp314-cp314-win_amd64.whl
| Download URL | rtmidi2-1.5.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 338.5 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
da63a582d74beab2d169ed0b61d26c9de27fddf624b057a8447f202b7abf2ed5
|
|
BLAKE2b-256 checksum How to use checksums |
06a04cf862ff71b80cba34826d98b1dbac93be95efb8bc3b1ee04744a42fc214
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp314-cp314-win32.whl
| Download URL | rtmidi2-1.5.0-cp314-cp314-win32.whl |
|---|---|
| Size | 321.6 kB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
e51c83f17393d61fccdf4faa75eea2f6ab649838fa7d80a492054a3777e91e95
|
|
BLAKE2b-256 checksum How to use checksums |
e9973c9717f4e032fac7783ef376a0ff5f42334ac91fee39f678f97907a9c5d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2b391cecb22e108f912dfbbf7d0caaba7a4d76ad34b92ca0f5cc72eb11a808c8
|
|
BLAKE2b-256 checksum How to use checksums |
4070645cbafedab61713f22abd429fc4ee57b398b5f735e471b1e85f394841de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / rtmidi2-1.5.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.5.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 174.8 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
35ab59fb5dc0cf738f1944a911a204e291deee7d7225e76697b9b6c829804e08
|
|
BLAKE2b-256 checksum How to use checksums |
03a50edf982441925a5f412f120b6d3f66257d9cb7fb218825486b2d97342a51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp314-cp314-macosx_10_15_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp314-cp314-macosx_10_15_x86_64.whl |
|---|---|
| Size | 181.5 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
eb4d2545d5580e02f4496f5d496e2bfbe5f7ccf007658959eaf1280a75e3b831
|
|
BLAKE2b-256 checksum How to use checksums |
c48663293ad9c83c70732a7d6f4a109a710704ff35cfe90f9a127131add240a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp313-cp313-win_amd64.whl
| Download URL | rtmidi2-1.5.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 327.0 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
902edd824806d5bb1b73316e14b2cd30bfcc28227e16c003059067b848800e75
|
|
BLAKE2b-256 checksum How to use checksums |
178d1003ad5bfc049e43bd89fbb8b3e7575ad150337f326bd0b5c29e01d51105
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp313-cp313-win32.whl
| Download URL | rtmidi2-1.5.0-cp313-cp313-win32.whl |
|---|---|
| Size | 313.0 kB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
b82b3a2c5b98cb123fcc1fe8a31b365e7c4595c08dfb447a1465860ffdc264e5
|
|
BLAKE2b-256 checksum How to use checksums |
58f9b1e83fbf73ad1559db26bba7e6541c133a3f08994d82a8ef7ea07cf25f9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b48dfa8ff5dd566fa16bd8dacb90a4e2d5dbcb858b21389bcb60a1d370aa760d
|
|
BLAKE2b-256 checksum How to use checksums |
b1e06dbf79e6fcf55e0417da8ce019ad40f35742ce16fad55df358494577784c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / rtmidi2-1.5.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.5.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 172.9 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e42a95d20336db408ef337d84821593a4c5a78a3870173baf54a033f18689ed4
|
|
BLAKE2b-256 checksum How to use checksums |
d032957885e56c7eaaf4ffb504109a2c389fa3e995d7992893d490d2559d42fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp313-cp313-macosx_10_13_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp313-cp313-macosx_10_13_x86_64.whl |
|---|---|
| Size | 180.5 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
3855e79ceedbfe8837ec9c5ce8c1a196f77bfd961dc6cb7bed8b6a0b5b6f7f26
|
|
BLAKE2b-256 checksum How to use checksums |
051660aa57a0bcbe05f515f16be4e6bfb8870328c4b187a14279beaf239181ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp312-cp312-win_amd64.whl
| Download URL | rtmidi2-1.5.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 327.4 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
291369d6e1c348ec1d007179b484e533a3ff1cc3522706d38089ed2fee963239
|
|
BLAKE2b-256 checksum How to use checksums |
ae7e6723a836fb3089bae18ef70c70c91a8367f1a147f8a73c61a1f977f70fc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp312-cp312-win32.whl
| Download URL | rtmidi2-1.5.0-cp312-cp312-win32.whl |
|---|---|
| Size | 313.1 kB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
c1820394078dd072dbf6968cd2278e6519a841ef690feaec6e60d11db1dc7040
|
|
BLAKE2b-256 checksum How to use checksums |
555ac5115eaffc3c83a271c755bd6b91c23bc1bb74b347c71cecf878d9807d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
d76af300722b7bb3c7eab382231006480d72bbd405637868d7edb10af302ad50
|
|
BLAKE2b-256 checksum How to use checksums |
5e76e43d5d45b7b48298214d6bd00005fe726acfa5080d7c1d6d3231d9328d8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / rtmidi2-1.5.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.5.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 172.4 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
755283110c1a92dbc8e57a8cd6e83581f380b33d1dc49fe6ac69c7cfc10ae50d
|
|
BLAKE2b-256 checksum How to use checksums |
18ad5f3467cd487dea1395fc69b3a57ff27f4af533d13593e0c77e7d9fcc6303
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 178.3 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
f544e848de0e1ab6739bbeeae61c14eb7c9d0fb103d95a7f7296861976f1223b
|
|
BLAKE2b-256 checksum How to use checksums |
f43ce1e7cfb725e762f9d51a5a61042a0f015837ff3b29ba5bdef3f7bc246271
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp311-cp311-win_amd64.whl
| Download URL | rtmidi2-1.5.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 329.6 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d56e9e1aabbec2ab2076639529e5d847a2259bdec7b8f255d8d671eba72ab57c
|
|
BLAKE2b-256 checksum How to use checksums |
d7317b22f6200adf486f38306e3bc20b463c5a05d5f133417de74e00aa6ed6ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp311-cp311-win32.whl
| Download URL | rtmidi2-1.5.0-cp311-cp311-win32.whl |
|---|---|
| Size | 314.3 kB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
b49c5c9dae4152e06f1bb833b438e361505ffae9b31924fccc07ff82ed7a4bdc
|
|
BLAKE2b-256 checksum How to use checksums |
5415d4664e3a6a02faa51b993c94ad8dcbf88b1c8d46b744aad6c1e0d617ca65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0b04eab0d87096e7ed4d75ff5bd253d17157990158d4f35bc92b767fe2a68755
|
|
BLAKE2b-256 checksum How to use checksums |
08bfa28b8ea7af2129e0c02cca24b552159d204e1a96d995e803ffb9db795741
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / rtmidi2-1.5.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.5.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 172.3 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3b3f0463e9d80749cf6e473f0d74cec00f9484067629420202d3a0ff489adb84
|
|
BLAKE2b-256 checksum How to use checksums |
2b09c81bd3078f7503a5caf383c1e7f03778f6ef46006d5b82329c908880acb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 180.7 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
ae4148ac1ec9a51fa1c4d40e033d94b8ba3dfad78d59ac1a23d6710579df5b54
|
|
BLAKE2b-256 checksum How to use checksums |
4873d4eb28713431d6e36d498686e71cf90f877f8d50cd84ac9ceed462bce07b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp310-cp310-win_amd64.whl
| Download URL | rtmidi2-1.5.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 329.4 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c0e6a2b272ace96a2abb07972f2c7a377eb8ac4355b455ebec00a1813427b8db
|
|
BLAKE2b-256 checksum How to use checksums |
4c75abc680dcad4b198387179d664df25f5f5d301fc5cf45bc2d3ff4ec10b32a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp310-cp310-win32.whl
| Download URL | rtmidi2-1.5.0-cp310-cp310-win32.whl |
|---|---|
| Size | 315.0 kB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
e32e6d30e0e2597d55606a79322a8f481b41f3100c1cb137f47ca705d04a7118
|
|
BLAKE2b-256 checksum How to use checksums |
62005931d90c80505631af9c2acdb5e47b7af8812c504e8c7b2605108e272408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
90032bdee5bf7c8d3f47d3a63f8cae138d45dd72e2dd25c3e38456b4d43d3b9b
|
|
BLAKE2b-256 checksum How to use checksums |
6bb1d68a3a6516849b4aa514d5c16874d21a58bb52a4251621a2839d1c7c95cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / rtmidi2-1.5.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.5.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 172.6 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bea0601c5a897ba89c875db777888f988f2f19654cdb8aed00c7abe2a50d7cd1
|
|
BLAKE2b-256 checksum How to use checksums |
ffb6fa4ff2d2a3efc160b8fe96933e4b6910c5e93e7c8db35cc170d8e73da483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / rtmidi2-1.5.0-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | rtmidi2-1.5.0-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 180.4 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
ccc0d5c74752cf0ddac093885f54319813e4a1eb5d2674bacbd5595672da5ca9
|
|
BLAKE2b-256 checksum How to use checksums |
4ff208ec8568709c6d7ec1dfa3abb80a84b8165212f1694d76c538d8dba73157
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for rtmidi2 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.