--- id: pretty-midi version: "0.2.11.post0" license: MIT license_treatment: permissive maintenance: active --- # pretty-midi — Functions and classes for handling MIDI data conveniently. License: permissive · Maintenance: active · Downloads: 255.6K/mo ## 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 above — verify before relying. Provides utilities for reading, modifying, and synthesizing MIDI data in a Python-friendly format, handling note manipulation, tempo estimation, and audio output. 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 pip install pretty-midi uv add pretty-midi poetry add pretty-midi ## Installing pretty-midi Before you install: Low friction install with four straightforward dependencies. Actively maintained with a recent release and steady commit history. 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() Synthesize requires fluidsynth program and pyfluidsynth package installed separately; basic MIDI parsing and manipulation work without them. 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: unspecified - Install friction: low - Maintenance: active - Downloads: 255.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags midi file parsing python, midi note manipulation, music information retrieval, midi synthesis audio, midi tempo analysis, midi chord creation, midi data extraction, music-information-retrieval, midi-synthesis [View on SkillFed](https://skillfed.io/packages/pretty-midi) · [View on PyPI](https://pypi.org/project/pretty-midi/)