Skip to main content

Python wrapper for RtMidi written in Cython. Allows sending raw messages, multi-port input and sending multiple messages in one call.

Project description

sh-downloads

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

https://rtmidi2.readthedocs.io


Usage Examples

rtmidi2 uses a very similar API as RtMidi

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.

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rtmidi2-1.4.1-cp313-cp313-win_amd64.whl (118.6 kB view details)

Uploaded CPython 3.13Windows x86-64

rtmidi2-1.4.1-cp313-cp313-win32.whl (103.3 kB view details)

Uploaded CPython 3.13Windows x86

rtmidi2-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rtmidi2-1.4.1-cp313-cp313-macosx_11_0_arm64.whl (137.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rtmidi2-1.4.1-cp313-cp313-macosx_10_13_x86_64.whl (150.0 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

rtmidi2-1.4.1-cp312-cp312-win_amd64.whl (118.5 kB view details)

Uploaded CPython 3.12Windows x86-64

rtmidi2-1.4.1-cp312-cp312-win32.whl (103.4 kB view details)

Uploaded CPython 3.12Windows x86

rtmidi2-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rtmidi2-1.4.1-cp312-cp312-macosx_11_0_arm64.whl (138.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rtmidi2-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl (151.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

rtmidi2-1.4.1-cp311-cp311-win_amd64.whl (119.8 kB view details)

Uploaded CPython 3.11Windows x86-64

rtmidi2-1.4.1-cp311-cp311-win32.whl (105.6 kB view details)

Uploaded CPython 3.11Windows x86

rtmidi2-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rtmidi2-1.4.1-cp311-cp311-macosx_11_0_arm64.whl (141.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rtmidi2-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl (151.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

rtmidi2-1.4.1-cp310-cp310-win_amd64.whl (119.8 kB view details)

Uploaded CPython 3.10Windows x86-64

rtmidi2-1.4.1-cp310-cp310-win32.whl (106.4 kB view details)

Uploaded CPython 3.10Windows x86

rtmidi2-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

rtmidi2-1.4.1-cp310-cp310-macosx_11_0_arm64.whl (139.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rtmidi2-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl (148.9 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

rtmidi2-1.4.1-cp39-cp39-win_amd64.whl (120.1 kB view details)

Uploaded CPython 3.9Windows x86-64

rtmidi2-1.4.1-cp39-cp39-win32.whl (106.7 kB view details)

Uploaded CPython 3.9Windows x86

rtmidi2-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

rtmidi2-1.4.1-cp39-cp39-macosx_11_0_arm64.whl (140.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

rtmidi2-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl (149.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file rtmidi2-1.4.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 118.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1301f6c2b864f560865d37db50db2076c68f963f01cf2de381b677048adacb2e
MD5 5e0f222bc1022ff806998a8e1b696ee7
BLAKE2b-256 438f216576e87c5b5bae7d64dc55ee1ed685be05940c5144a64e76d68c24e17c

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp313-cp313-win32.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 103.3 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 4039d91bdc13885dd505c03aa06254a0fb4353fec215d617b9b7b1f813db1936
MD5 295f2a7c9560f529d41c17a13f7c395e
BLAKE2b-256 b6b8240ae0af90547cacd3e43ae18641e10ff3c7425ade96330b17d37ee63335

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b4dbba5b36075059ece8b5a810f9ae1639f966b0164489f8a2badb81d48fba12
MD5 2c8977ea8eb999699dc3db68ea443b8d
BLAKE2b-256 5cfe46049c766d500c85e0eda0486dc1a154403401849e52fc1ef69bbe7010ec

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1821868013a70d138ebcf435bf2f6a65e3a04c30bc8458951d25d10ae45d109
MD5 cd88d9d4d7c5ed9677e0c178abe6ecdb
BLAKE2b-256 fcd0ef09cf14e1e45aeeba44619e655f34175733603a3edd854b52a10e47581c

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 25dd3cc37f0731eaa0f36424bb5e50935cd4385ab6123c9f3e5e0a71f5bdc523
MD5 d304a75435021c43b8a43ef2ed8c8090
BLAKE2b-256 01de13232685040dc1b36c491658f0261110ec86ce71dbbae37a0f2af45fed18

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 118.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 77f6d4ecc1cd56775bc75615a60270deaeb2514a9f7f235ce91e13da0836f556
MD5 e00d00b2315c6c433a11c3b50eb426d2
BLAKE2b-256 9982826a7a186b1bcaaad1b1c8e1fb54b2229b434123365076cbdd1c18b32503

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 103.4 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 8a0cb524d68f261bf866c00327d3228a6310116eaa9dd898b6f7c8ab94d14619
MD5 ade684f1f79ee0391be147611c423889
BLAKE2b-256 b97aa31a7d9b6d18b96a11c952e07ea4e3180816805848620ac85b9eeaed7b39

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2270b773302806209eb3aec341156ef841e2f5ea7a83f5b242311d0da1df3a76
MD5 f0c8df282d1ba9c97331d19b20cc5d38
BLAKE2b-256 cc08e426f1a8dae34acb8a13a0eca47970a78955a0c00395efe89a94ef04ad49

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 985f260859c66751d1a60849a694bd58ab49e5f15fd9a713123de3febdd3080d
MD5 83db10079953eece6ee8b9eb0a558170
BLAKE2b-256 2b00565e0114c7987576abf055fb68f60621b84e7f96825db4ff70e2723684c6

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4b0dd67d7a2725252f038ba6dd1681f904842ec72222180e499e551555312c60
MD5 f9bace7ff3542960762ef0c6e12a1cef
BLAKE2b-256 f7b33225a8e5bdc3f9f34395f43ebb19b00a23cf6e58cae7999822d647bec2c2

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 119.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 efc74a8f3ae28f1366373fb8d55f09447b53e6eca4723698bd949874dc661eba
MD5 c7beb0bf3a3e47d2ccb4b2c1678b93e0
BLAKE2b-256 63e65bd4e189e8b350c833bcc5d498fa378839355b8c113fb58441ef458146e9

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 105.6 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 2eb1310b607953009a6f370d1aba2362f325ae31a44dbac39755f3edce6fa284
MD5 b789dbc53cc5a554b02398e39fff121f
BLAKE2b-256 a4c0e930697f7b664b465a4454b160eea92c41992224e7884fa2024eda6ab2ec

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 807507be5043117d5a55fbcc6d8a3acfe2dc713b75aafc0049d677e638f94e2a
MD5 01f7a33974fbccba285ce18e089cbdea
BLAKE2b-256 89cd4446eff63c71450734de29f0949db75d27f9e2a3b946e1126b6ffabb2ab2

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4109b1a1f71b0d8742affeefdbac98c187ba37dbe7d3bc724d4959fd61ce9f1
MD5 527543a75215acdd1c313ccc2eb462be
BLAKE2b-256 1591a0aad359014618125f4f5c3308fae84244686033020c7d4ee4158502b30f

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 caed82a513be7ed7db9d6a80ec4d9f22050c80a97b4b474e25aeae48b501259c
MD5 f29867a00554cfa24e18118fb25f7e20
BLAKE2b-256 695b8383f380ebbaf7387c7adcc558ca55e510e5a480e29fd4286892b6b3d472

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 119.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c9e9bb37a7a25ae990accd6cbfc657005da2ef2c8ec052a539c6aff792f3eab0
MD5 ccbadf9e6ccbcaadf6a4d3d74b37e116
BLAKE2b-256 eeb31d35edfc7a2a6b6db64bad7183ec2be835a90b8745cd787672c150ede86e

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 106.4 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 a62f103b6f5c96de2a4e0fdc42b6a405b07014da042c10aa193e024a85054829
MD5 754b5feb1c1e6b7f6aba3bb970276bde
BLAKE2b-256 cabd53051a390dbc0e0e957bad0b4ccf2a56b24768ebd73084fae10fcab665a5

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31ef2589f047c7e7f2e7e455adc0df93a19735274c4785e5d2d2fd3b99219df0
MD5 70ee4c81876e0df79282b34d8bb21254
BLAKE2b-256 0d5d106e11f5f1f4c14218b508aa01e2f7d28ec1b8fb881775eb2df889447f6c

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff3a24c89e0d0e9683c280791316c5f2dfd94b5ed290d769951d13e9892556da
MD5 e5069c48d11ccab1a983f5ff2a0f3020
BLAKE2b-256 434c8b018e6ce5b36cc9e3458288b07dadb8d7ef5ea9a607670232b1c3f1c35a

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d1b64931a66abf7e27bcda3b43fdda9461c4adc6c0b42d60fcf96161652989c9
MD5 1c8f6e5d5b523dfba90bb240738823fa
BLAKE2b-256 8bfb25f6eee3493337f1611315cbd7c561c6c99025b41e38e0d77e392ffc0e0d

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 120.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b6a06a98dfd6f8ddfcf35586964f7d44ada35f508fef3839b08eb5521235e9c1
MD5 3e529af7f4e3dafc4d0424facff34eb8
BLAKE2b-256 b0e2efb67dbce2d3c435668534686935d0377645d04c85a168ff595708ab10ab

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp39-cp39-win32.whl.

File metadata

  • Download URL: rtmidi2-1.4.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 106.7 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rtmidi2-1.4.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 77c86e284946a1ef84bcc0a0160a299215e303a8c4446ef775e41e1dc778cba1
MD5 38e07c5fa7c938ee9bd29738a8d84668
BLAKE2b-256 741ee7045fb4733710ec7d06880e35a10d12bb0258556f2f47fd5d1706a08e37

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7759912292f132388b6da5e6e0439071763086fbc32091b8848c0a3470251cf0
MD5 f798aedf7399cd10f96b42c96b1b9a84
BLAKE2b-256 82fbbcfadc937a77d4e78367193a619e26b0ec641721d60e2d5c12d9f580d3c7

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8e686a814036e07d1f41832d33c7b2dea12aae5999777a2b3afa33a560c6a0e
MD5 633466cda80693a4cf14fb4360e22661
BLAKE2b-256 46914b38002c583822a893308053e03c9ce16814226b0c096192e0bee0216c48

See more details on using hashes here.

File details

Details for the file rtmidi2-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for rtmidi2-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 58c58c3f15c97776a108e098b5194c88bab22080e1b8999eb35cb05660cf66e9
MD5 448e6c3c98a713104b47a995429674e8
BLAKE2b-256 b5bc824596e3c52607a7f9286f03b6138378f4f729d2ae9cfc37033e312e8aaf

See more details on using hashes here.

Supported by

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