pretty-midi
Functions and classes for handling MIDI data conveniently.
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and fills a clear niche in MIDI manipulation. It is well-suited for music information retrieval, composition automation, and MIDI editing workflows. No known vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Synthesize requires fluidsynth program and pyfluidsynth package installed separately; basic MIDI parsing and manipulation work without them.
- Low friction install with four straightforward dependencies.
- Actively maintained with a recent release and steady commit history.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
last release 2026-07-28 (17 days) · last repo commit 2026-02-18 · 1,035 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 255,627 downloads/mo, #8,475 on PyPI
Alternatives
Verify before relying
import pretty_midi
midi_data = pretty_midi.PrettyMIDI('example.mid')
print(midi_data.estimate_tempo())
audio_data = midi_data.synthesize()- Whether synthesize() output format and sample rate are documented or configurable
- Performance characteristics with large MIDI files or many instruments
- Python version compatibility (requires_python not specified in metadata)
What it is and what it does
pretty_midi wraps MIDI file handling in Python objects that expose notes, instruments, and timing as directly modifiable attributes rather than raw binary data. It lets you load a MIDI file, inspect its tempo and harmonic content, shift pitches, add or remove notes, and write the result back to disk or synthesize it to audio. The library depends on numpy for numerical operations, mido for MIDI I/O, six for Python 2/3 compatibility, and importlib_resources for resource loading.
The package is designed for music information retrieval and composition workflows—analyzing existing MIDI files to extract features like key or tempo, programmatically creating MIDI from scratch by building instruments and note objects, or transforming MIDI data by iterating over its structure. Audio synthesis is optional and requires external dependencies (fluidsynth and pyfluidsynth).
Use it for
- Analyze MIDI files to extract tempo, key, or note statistics for music research
- Programmatically generate MIDI files by creating instruments and adding notes with specific pitches and timings
- Transpose or shift all notes in a MIDI file by a fixed interval
- Extract individual instrument tracks or filter notes by criteria for remixing
- Synthesize MIDI to audio waveforms for playback or further processing
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has low install friction, carries a permissive MIT license, and fills a clear niche in MIDI manipulation. It is well-suited for music information retrieval, composition automation, and MIDI editing workflows. No known vulnerabilities.
Install
pretty-midi on PyPI
Before you install
Low friction install with four straightforward dependencies. Actively maintained with a recent release and steady commit history.
Synthesize requires fluidsynth program and pyfluidsynth package installed separately; basic MIDI parsing and manipulation work without them.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects.
Quickstart
import pretty_midi
midi_data = pretty_midi.PrettyMIDI('example.mid')
print(midi_data.estimate_tempo())
audio_data = midi_data.synthesize()
Verify before relying
- Whether synthesize() output format and sample rate are documented or configurable
- Performance characteristics with large MIDI files or many instruments
- Python version compatibility (requires_python not specified in metadata)
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesnumpymidosiximportlib_resources |
| Maintenance | Actively maintained 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 255,627 / month, #8,475 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonTopic :: Multimedia :: Sound/Audio :: MIDI |
Evidence: pretty_midi-0.2.11.post0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “midi file parsing python”
- pretty-midiProvides utilities for reading, modifying, and synthesizing MIDI data…
- symusicsymusic parses and transforms MIDI and ABC files at note level with…
- midoMido provides a Python library for creating, parsing, and sending…
Give your agent the search over MCP, or paste the wish link into any chat.
More Sound/Audio packages
Reads and writes audio files in formats like WAV, FLAC, OGG, and MAT through libsndfile, exposing audio data as NumPy arrays.
Pydub provides a high-level Python interface for loading, manipulating, and exporting audio files with simple operations like slicing, concatenation, and format conversion.
However, the abandoned status since 2021-03-10 means no future fixes or compatibility updates—use it only if you can tolerate potential issues with newer Python…
Mutagen reads and writes audio metadata (tags) across many audio formats including MP3, FLAC, OGG, MP4, WavPack, and others, supporting ID3v2 and APEv2 tag editing.
Install it if you need to read or edit audio tags programmatically.
Provides PyTorch-based audio processing, transforms, and dataloaders for machine learning tasks, with GPU acceleration and autograd support for trainable audio features.
MoviePy is a Python library for video editing that reads, processes, and writes video and audio files by converting them to numpy arrays for frame-level manipulation and effect application.
Reads metadata (artist, title, duration, bitrate, and more) from audio files in formats including MP3, MP4, FLAC, OGG, WAV, and others, without writing or modifying tags.
Install it if you need to extract metadata from audio files without the overhead of a heavier library.
See also symusic · music21 · librosa · mido · basic-pitch · python-stretch · pyrubberband · syncedlyrics · mir-eval · python-rtmidi