skillfed

music21

A Toolkit for Computer-Aided Musical Analysis and Computational Musicology.

music21 v10.5.0 409.5K downloads/30d#6,871 on PyPI2,558
Permissive license BSD-3-Clause Active released

What it is and what it does

music21 is a Python library for symbolic music analysis and computational musicology, developed at MIT since 2010. It provides tools to parse, analyze, and manipulate musical scores in formats like MusicXML and MIDI, enabling programmatic access to musical notation, pitch, rhythm, harmony, and other analytical properties. The library is built on standard scientific Python dependencies (numpy, matplotlib, joblib) and supports modern Python versions (3.11+).

Typical workflows involve loading scores from files or URLs, traversing their hierarchical structure to extract notes and measures, performing analytical operations (harmonic analysis, voice leading checks, statistical studies), and generating visualizations or new scores. It's commonly used in music education, research, and computational analysis projects where symbolic representation of music is more relevant than audio processing.

Use it for:

  • Analyze harmonic progressions and voice leading in classical scores for music theory research.
  • Extract melodic or rhythmic patterns from a collection of scores for statistical musicology studies.
  • Programmatically generate or modify MusicXML scores based on algorithmic composition rules.
  • Build educational tools that parse student compositions and provide automated feedback on notation or structure.
  • Convert between MIDI and MusicXML formats for integration with other music software workflows.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

music21 is a Python toolkit for analyzing, processing, and computationally working with musical scores and MIDI data, supporting symbolic music representation and analysis workflows.

Yes, if you work with symbolic music notation, analysis, or computational musicology. Low install friction, active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. Not suitable if you need audio processing or real-time synthesis—music21 works with symbolic scores, not sound files.

Install

music21 on PyPI

pip

pip install music21

uv

uv add music21

poetry

poetry add music21

Installing music21

Before you install

Low friction: pure Python wheel with 8 runtime dependencies (chardet, joblib, jsonpickle, matplotlib, more-itertools, numpy, requests, webcolors). Active maintenance with a commit from 2026-08-12 and a release 58 days prior.

License in practice

BSD-3-Clause permissive license. Free to use, modify, and distribute provided you retain the LICENSE file and copyright notice. Externally provided software and encoded musical scores in the corpus may carry separate licenses.

Quickstart

pip install music21

from music21 import converter, stream

# Load and analyze a score
score = converter.parse('path/to/score.musicxml')
for note in score.flatten().notes:
    print(note.pitch, note.quarterLength)

Requires Python 3.11 or later.

Verify before relying

  • Whether matplotlib is required for all use cases or only for visualization features.
  • Whether external music notation software (e.g., MuseScore, Finale) is needed for rendering or playback.
  • Performance characteristics when processing large scores or corpora.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 8 — chardet, joblib, jsonpickle, matplotlib, more-itertools, numpy, requests, webcolors
Maintenance actively maintained — 58 days since the last release
Last repo commit
First released
Downloads 409,505/month — #6,871 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: music21-10.5.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: End Users/DesktopIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Artistic SoftwareTopic :: Multimedia :: Sound/AudioTopic :: Multimedia :: Sound/Audio :: ConversionTopic :: Multimedia :: Sound/Audio :: MIDITopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

music analysis pythonsymbolic music processingmusicology toolkitmidi score analysiscomputational musicmusic notation parsingmusic theory automation
music-analysissymbolic-notationmusicology

More Python Modules packages