music21
Toolkit for computer-aided musicology and symbolic-music analysis and generation.
| Language | Python |
|---|---|
| Category | Composition & notation |
| License | BSD-3-Clause |
| Platforms | macOS Windows Linux |
| Install | pip install music21 |
| First released | 2010 |
| Maintained | Yes |
| Links | Website · Source |
Strengths
- Deep music-theory/analysis API (keys, chords, roman numerals)
- Reads/writes MusicXML, MIDI, ABC, MEI; renders via MuseScore/LilyPond
- Large corpus of scores bundled in
Limitations
- Heavy dependency for simple tasks
- Symbolic notation only, not real-time audio/synthesis
Best for
Analyzing and manipulating symbolic scores and computational-musicology research.
Minimal example
from music21 import note, stream
s = stream.Stream()
s.append(note.Note('C4', quarterLength=1))
s.append(note.Note('E4'))
s.show('text')