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.9
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, delta_time)
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))
License
rtmidi2 is licensed under the MIT License, see LICENSE.
It uses RtMidi, licensed under a modified MIT License, see RtMidi/RtMidi.h.
Release files for rtmidi2 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 11.5 MB
Release files / rtmidi2-1.4.1-cp313-cp313-win_amd64.whl
| Download URL | rtmidi2-1.4.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 118.6 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1301f6c2b864f560865d37db50db2076c68f963f01cf2de381b677048adacb2e
|
|
BLAKE2b-256 checksum How to use checksums |
438f216576e87c5b5bae7d64dc55ee1ed685be05940c5144a64e76d68c24e17c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp313-cp313-win32.whl
| Download URL | rtmidi2-1.4.1-cp313-cp313-win32.whl |
|---|---|
| Size | 103.3 kB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
4039d91bdc13885dd505c03aa06254a0fb4353fec215d617b9b7b1f813db1936
|
|
BLAKE2b-256 checksum How to use checksums |
b6b8240ae0af90547cacd3e43ae18641e10ff3c7425ade96330b17d37ee63335
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
b4dbba5b36075059ece8b5a810f9ae1639f966b0164489f8a2badb81d48fba12
|
|
BLAKE2b-256 checksum How to use checksums |
5cfe46049c766d500c85e0eda0486dc1a154403401849e52fc1ef69bbe7010ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.4.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 137.1 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c1821868013a70d138ebcf435bf2f6a65e3a04c30bc8458951d25d10ae45d109
|
|
BLAKE2b-256 checksum How to use checksums |
fcd0ef09cf14e1e45aeeba44619e655f34175733603a3edd854b52a10e47581c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp313-cp313-macosx_10_13_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp313-cp313-macosx_10_13_x86_64.whl |
|---|---|
| Size | 150.0 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
25dd3cc37f0731eaa0f36424bb5e50935cd4385ab6123c9f3e5e0a71f5bdc523
|
|
BLAKE2b-256 checksum How to use checksums |
01de13232685040dc1b36c491658f0261110ec86ce71dbbae37a0f2af45fed18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp312-cp312-win_amd64.whl
| Download URL | rtmidi2-1.4.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 118.5 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
77f6d4ecc1cd56775bc75615a60270deaeb2514a9f7f235ce91e13da0836f556
|
|
BLAKE2b-256 checksum How to use checksums |
9982826a7a186b1bcaaad1b1c8e1fb54b2229b434123365076cbdd1c18b32503
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp312-cp312-win32.whl
| Download URL | rtmidi2-1.4.1-cp312-cp312-win32.whl |
|---|---|
| Size | 103.4 kB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
8a0cb524d68f261bf866c00327d3228a6310116eaa9dd898b6f7c8ab94d14619
|
|
BLAKE2b-256 checksum How to use checksums |
b97aa31a7d9b6d18b96a11c952e07ea4e3180816805848620ac85b9eeaed7b39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2270b773302806209eb3aec341156ef841e2f5ea7a83f5b242311d0da1df3a76
|
|
BLAKE2b-256 checksum How to use checksums |
cc08e426f1a8dae34acb8a13a0eca47970a78955a0c00395efe89a94ef04ad49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.4.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 138.3 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
985f260859c66751d1a60849a694bd58ab49e5f15fd9a713123de3febdd3080d
|
|
BLAKE2b-256 checksum How to use checksums |
2b00565e0114c7987576abf055fb68f60621b84e7f96825db4ff70e2723684c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 151.2 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
4b0dd67d7a2725252f038ba6dd1681f904842ec72222180e499e551555312c60
|
|
BLAKE2b-256 checksum How to use checksums |
f7b33225a8e5bdc3f9f34395f43ebb19b00a23cf6e58cae7999822d647bec2c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp311-cp311-win_amd64.whl
| Download URL | rtmidi2-1.4.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 119.8 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
efc74a8f3ae28f1366373fb8d55f09447b53e6eca4723698bd949874dc661eba
|
|
BLAKE2b-256 checksum How to use checksums |
63e65bd4e189e8b350c833bcc5d498fa378839355b8c113fb58441ef458146e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp311-cp311-win32.whl
| Download URL | rtmidi2-1.4.1-cp311-cp311-win32.whl |
|---|---|
| Size | 105.6 kB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
2eb1310b607953009a6f370d1aba2362f325ae31a44dbac39755f3edce6fa284
|
|
BLAKE2b-256 checksum How to use checksums |
a4c0e930697f7b664b465a4454b160eea92c41992224e7884fa2024eda6ab2ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
807507be5043117d5a55fbcc6d8a3acfe2dc713b75aafc0049d677e638f94e2a
|
|
BLAKE2b-256 checksum How to use checksums |
89cd4446eff63c71450734de29f0949db75d27f9e2a3b946e1126b6ffabb2ab2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.4.1-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 141.8 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c4109b1a1f71b0d8742affeefdbac98c187ba37dbe7d3bc724d4959fd61ce9f1
|
|
BLAKE2b-256 checksum How to use checksums |
1591a0aad359014618125f4f5c3308fae84244686033020c7d4ee4158502b30f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 151.1 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
caed82a513be7ed7db9d6a80ec4d9f22050c80a97b4b474e25aeae48b501259c
|
|
BLAKE2b-256 checksum How to use checksums |
695b8383f380ebbaf7387c7adcc558ca55e510e5a480e29fd4286892b6b3d472
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp310-cp310-win_amd64.whl
| Download URL | rtmidi2-1.4.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 119.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c9e9bb37a7a25ae990accd6cbfc657005da2ef2c8ec052a539c6aff792f3eab0
|
|
BLAKE2b-256 checksum How to use checksums |
eeb31d35edfc7a2a6b6db64bad7183ec2be835a90b8745cd787672c150ede86e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp310-cp310-win32.whl
| Download URL | rtmidi2-1.4.1-cp310-cp310-win32.whl |
|---|---|
| Size | 106.4 kB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
a62f103b6f5c96de2a4e0fdc42b6a405b07014da042c10aa193e024a85054829
|
|
BLAKE2b-256 checksum How to use checksums |
cabd53051a390dbc0e0e957bad0b4ccf2a56b24768ebd73084fae10fcab665a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
31ef2589f047c7e7f2e7e455adc0df93a19735274c4785e5d2d2fd3b99219df0
|
|
BLAKE2b-256 checksum How to use checksums |
0d5d106e11f5f1f4c14218b508aa01e2f7d28ec1b8fb881775eb2df889447f6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.4.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 139.2 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ff3a24c89e0d0e9683c280791316c5f2dfd94b5ed290d769951d13e9892556da
|
|
BLAKE2b-256 checksum How to use checksums |
434c8b018e6ce5b36cc9e3458288b07dadb8d7ef5ea9a607670232b1c3f1c35a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 148.9 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
d1b64931a66abf7e27bcda3b43fdda9461c4adc6c0b42d60fcf96161652989c9
|
|
BLAKE2b-256 checksum How to use checksums |
8bfb25f6eee3493337f1611315cbd7c561c6c99025b41e38e0d77e392ffc0e0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp39-cp39-win_amd64.whl
| Download URL | rtmidi2-1.4.1-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 120.1 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b6a06a98dfd6f8ddfcf35586964f7d44ada35f508fef3839b08eb5521235e9c1
|
|
BLAKE2b-256 checksum How to use checksums |
b0e2efb67dbce2d3c435668534686935d0377645d04c85a168ff595708ab10ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp39-cp39-win32.whl
| Download URL | rtmidi2-1.4.1-cp39-cp39-win32.whl |
|---|---|
| Size | 106.7 kB |
| Tags | CPython 3.9 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
77c86e284946a1ef84bcc0a0160a299215e303a8c4446ef775e41e1dc778cba1
|
|
BLAKE2b-256 checksum How to use checksums |
741ee7045fb4733710ec7d06880e35a10d12bb0258556f2f47fd5d1706a08e37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7759912292f132388b6da5e6e0439071763086fbc32091b8848c0a3470251cf0
|
|
BLAKE2b-256 checksum How to use checksums |
82fbbcfadc937a77d4e78367193a619e26b0ec641721d60e2d5c12d9f580d3c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | rtmidi2-1.4.1-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 140.0 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b8e686a814036e07d1f41832d33c7b2dea12aae5999777a2b3afa33a560c6a0e
|
|
BLAKE2b-256 checksum How to use checksums |
46914b38002c583822a893308053e03c9ce16814226b0c096192e0bee0216c48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / rtmidi2-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | rtmidi2-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 149.5 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
58c58c3f15c97776a108e098b5194c88bab22080e1b8999eb35cb05660cf66e9
|
|
BLAKE2b-256 checksum How to use checksums |
b5bc824596e3c52607a7f9286f03b6138378f4f729d2ae9cfc37033e312e8aaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|