mido
MIDI Objects for Python
What it is and what it does
Mido is a Python library for working with MIDI (Musical Instrument Digital Interface) messages and files. It abstracts away the complexity of MIDI protocol details by providing convenient message objects that you can create, inspect, and modify. The library supports reading and writing MIDI files, sending and receiving MIDI messages through ports, and includes a reusable MIDI stream parser.
The core use case is building music production tools, sequencers, controllers, or any application that needs to communicate with MIDI hardware or software synthesizers. Mido handles all 18 standard MIDI message types and provides a unified port API that works across multiple backends (RtMidi, PortMidi, Pygame), so you can write code once and switch backends without changing your application logic. It also supports MIDI over TCP/IP for wireless communication between computers.
Use it for:
- Build a MIDI controller or sequencer that sends note messages to a synthesizer or DAW
- Read and playback MIDI files programmatically with full access to every message and meta-event
- Listen to incoming MIDI from hardware controllers and respond in real time
- Convert between MIDI file formats or extract/modify MIDI data from existing files
- Implement wireless MIDI communication between computers using TCP/IP sockets
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Mido provides a Python library for creating, parsing, and sending MIDI messages and files, with support for multiple backends (RtMidi, PortMidi, Pygame) and port I/O.
Yes. Mido is a stable, actively maintained library with no known vulnerabilities, low install friction, and permissive licensing. It is the standard choice for MIDI work in Python and has a clear, well-documented API. Install it if you need to work with MIDI messages, files, or hardware in any capacity.
Install
mido on PyPI
pip
pip install midouv
uv add midopoetry
poetry add midoInstalling mido
Before you install
Low friction installation with only two lightweight runtime dependencies (packaging and importlib-metadata). The project is actively maintained with a recent commit on 2026-06-27 and has been stable since its initial 2013 release.
License in practice
MIT license is permissive and imposes no restrictions on commercial or proprietary use, modification, or redistribution as long as the license text is included.
Quickstart
pip install mido
import mido
msg = mido.Message('note_on', note=60)
print(msg.type, msg.note)
with mido.open_input() as inport:
for msg in inport:
print(msg)
For port I/O, you may need to install an optional backend (e.g., mido[ports-rtmidi]) and have the corresponding system library (RtMidi, PortMidi, or Pygame) available.
Verify before relying
- Whether the default installation works without optional port backends or if RtMidi/PortMidi system libraries are required for basic MIDI I/O
- Performance characteristics when handling large MIDI files or high-frequency message streams
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (~=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — packaging, importlib-metadata |
| Maintenance | actively maintained — 658 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 893,445/month — #4,795 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mido-1.3.3-py3-none-any.whl
Keywords: python, midi, midifile
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
python-rtmidipython-rtmidi provides a Python interface to…
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
pyobjc-framework-CoreMIDIProvides Python bindings to macOS's CoreMIDI…
permissive · top 15,000 on PyPI
music21music21 is a Python toolkit for analyzing,…
permissive · top 15,000 on PyPI
aubioaubio is a Python wrapper around a C library…
copyleft · top 15,000 on PyPI
PyAudioPyAudio provides Python bindings for PortAudio…
permissive · top 5,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI
pydubPydub provides a high-level Python interface…
permissive · top 5,000 on PyPI