python-rtmidi
A Python binding for the RtMidi C++ library implemented using Cython.
What it is and what it does
python-rtmidi is a thin Python wrapper around the RtMidi C++ library, implemented using Cython. It exposes a cross-platform API for MIDI input and output on Windows (MultiMedia System), macOS (CoreMIDI and JACK), and Linux (ALSA and JACK). The package adapts RtMidi's C++ interface to Python conventions, allowing developers to open MIDI ports, send note-on/note-off messages, and manage virtual ports without writing C++ code.
The library is production-stable and supports Python 3.8 and later. It has no runtime Python dependencies, only the compiled RtMidi C++ bindings. Wheels are pre-built for common platforms (macOS Intel/ARM, Linux x86_64/aarch64, Windows x86_64), reducing installation friction for most users. The package is suitable for music software, hardware control, and real-time MIDI sequencing applications.
Use it for:
- Send MIDI note messages to a synthesizer or DAW from a Python script or application.
- Receive MIDI input from a keyboard or controller and process it in real-time.
- Create a virtual MIDI port to route messages between applications on the same system.
- Build a Python-based MIDI sequencer or control surface for music production.
- Interface with hardware MIDI devices (drum machines, synthesizers) from Python code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
python-rtmidi provides a Python interface to the RtMidi C++ library for sending and receiving MIDI messages across Windows, macOS, and Linux systems.
Yes, if you need MIDI I/O in Python. The package is stable (Production/Stable status), permissively licensed, has no runtime dependencies, and offers broad platform and Python version coverage. Install friction is moderate due to compiled bindings, but pre-built wheels mitigate this for standard platforms. The last release is from November 2023 and the repository remains active; aging maintenance is typical for a mature, feature-complete library.
Install
python-rtmidi on PyPI
pip
pip install python-rtmidiuv
uv add python-rtmidipoetry
poetry add python-rtmidiInstalling python-rtmidi
Before you install
Medium install friction due to compiled C++ bindings; wheels are available for Python 3.8–3.12 on macOS (Intel and ARM), Linux (x86_64 and aarch64), and Windows. Last release was in November 2023; repository remains active with a recent commit in January 2026.
License in practice
MIT License (permissive). The package and its underlying RtMidi C++ library are both released under MIT terms, allowing free use, modification, and distribution with minimal restrictions.
Quickstart
import rtmidi
import time
midiout = rtmidi.MidiOut()
available_ports = midiout.get_ports()
if available_ports:
midiout.open_port(0)
else:
midiout.open_virtual_port("My virtual output")
with midiout:
note_on = [0x90, 60, 112]
note_off = [0x80, 60, 0]
midiout.send_message(note_on)
time.sleep(0.5)
midiout.send_message(note_off)
Requires a MIDI output device or virtual MIDI port available on the system; on Linux, ALSA or JACK must be configured; on macOS, CoreMIDI is built-in; on Windows, MultiMedia System is built-in.
Verify before relying
- Whether the package handles MIDI input (MidiIn) with the same API surface as MidiOut, or if input support has different constraints.
- Performance characteristics and latency guarantees for real-time MIDI applications.
- Whether virtual port creation is supported on all three platforms or only on some.
Package facts
| License | Copyright & License =================== python-rtmidi was written by Christopher Arndt, 2012 - 2023. The software is released unter the MIT License: Copyright (c) 2012 - 2023 Christopher Arndt… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | aging — 998 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 103,536/month — #12,800 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_rtmidi-1.5.8-cp310-cp310-macosx_10_9_x86_64.whl; python_rtmidi-1.5.8-cp310-cp310-macosx_11_0_arm64.whl; python_rtmidi-1.5.8-cp310-cp310-manylinux_2_28_aarch64.whl; python_rtmidi-1.5.8-cp310-cp310-manylinux_2_28_x86_64.whl; python_rtmidi-1.5.8-cp310-cp310-win_amd64.whl; python_rtmidi-1.5.8-cp311-cp311-macosx_10_9_x86_64.whl; python_rtmidi-1.5.8-cp311-cp311-macosx_11_0_arm64.whl; python_rtmidi-1.5.8-cp311-cp311-manylinux_2_28_aarch64.whl; python_rtmidi-1.5.8-cp311-cp311-manylinux_2_28_x86_64.whl; python_rtmidi-1.5.8-cp311-cp311-win_amd64.whl; python_rtmidi-1.5.8-cp312-cp312-macosx_10_9_x86_64.whl; python_rtmidi-1.5.8-cp312-cp312-macosx_11_0_arm64.whl; python_rtmidi-1.5.8-cp312-cp312-manylinux_2_28_aarch64.whl; python_rtmidi-1.5.8-cp312-cp312-manylinux_2_28_x86_64.whl; python_rtmidi-1.5.8-cp312-cp312-win_amd64.whl; python_rtmidi-1.5.8-cp38-cp38-macosx_10_9_x86_64.whl; python_rtmidi-1.5.8-cp38-cp38-macosx_11_0_arm64.whl; python_rtmidi-1.5.8-cp38-cp38-manylinux_2_28_aarch64.whl; python_rtmidi-1.5.8-cp38-cp38-manylinux_2_28_x86_64.whl; python_rtmidi-1.5.8-cp38-cp38-win_amd64.whl
Keywords: MIDI, multimedia, music, rtmidi
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
midoMido provides a Python library for creating,…
permissive · top 5,000 on PyPI
pyobjc-framework-CoreMIDIProvides Python bindings to macOS's CoreMIDI…
permissive · top 15,000 on PyPI
symusicsymusic parses and transforms MIDI and ABC…
permissive · top 15,000 on PyPI
pretty-midiProvides utilities for reading, modifying, and…
permissive · top 15,000 on PyPI
python-oscpython-osc implements Open Sound Control (OSC)…
unclear · top 15,000 on PyPI
music21music21 is a Python toolkit for analyzing,…
permissive · top 15,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI
PyAudioPyAudio provides Python bindings for PortAudio…
permissive · top 5,000 on PyPI
python-mpvPython ctypes-based interface to the mpv media…
copyleft · top 15,000 on PyPI