
TechRxiv
A preprint server for health sciences.

The industry-standard Python toolkit for computer-aided musicology and symbolic music analysis.

music21 is a powerful Python-based framework designed for the analysis, transformation, and generation of music in symbolic formats such as MusicXML, MIDI, ABC, and Humdrum. Developed at MIT by Michael Cuthbert and a global community, it has evolved into the cornerstone of computational musicology. By 2026, music21 has solidified its position as the primary pre-processing engine for Symbolic Music Large Language Models (LLMs), allowing researchers to convert complex polyphonic scores into structured datasets suitable for tokenization and neural network training. Its technical architecture is centered around a hierarchical 'Stream' object model, which enables users to navigate through musical scores across multiple temporal and structural dimensions—such as parts, measures, chords, and notes—simultaneously. Unlike audio-processing libraries, music21 operates on the semantics of music, providing sophisticated tools for Roman numeral analysis, melodic contour detection, and rhythmic transformation. It integrates seamlessly with Jupyter Notebooks for interactive research and supports external engraving software like MuseScore and Finale for high-quality visualization of computed results. Its open-source nature ensures it remains the most extensible platform for academic research and professional music software development.
music21 is a powerful Python-based framework designed for the analysis, transformation, and generation of music in symbolic formats such as MusicXML, MIDI, ABC, and Humdrum.
Explore all tools that specialize in algorithmic analysis. This domain focus ensures music21 delivers optimized results for this specific requirement.
Nested object containers that represent musical time and structure, allowing for complex multi-threaded musical navigation.
Algorithms that identify keys and chord functions based on pitch-class content and proximity.
A built-in database and search functionality for thousands of classical scores (Bach, Palestrina, etc.).
Extracts over 70 distinct musical features such as melodic intervals, rhythmic density, and pitch range.
Automated conversion from MusicXML or MIDI to Braille music notation.
Modules to check for parallel fifths, octaves, and other counterpoint rules.
Lossless conversion between legacy formats like Humdrum and modern formats like MusicXML.
Install Python 3.10+ environment.
Execute 'pip install music21' via terminal.
Install MuseScore as the default external MusicXML reader for visualization.
Verify installation by importing music21 in a Python shell.
Run music21.configure.run() to set up local file paths for external engravers.
Load a score using the corpus.parse() or converter.parse() methods.
Explore score structure using .show('text') to understand hierarchy.
Apply musicological filters (e.g., .getElementsByClass('Note')) to extract data.
Utilize the built-in corpus for initial testing and benchmarking.
Integrate with Jupyter Notebooks for inline graphical rendering.
All Set
Ready to go
Verified feedback from other users.
"Widely praised for its depth and academic rigor. Users note a steep learning curve but emphasize it is the only viable tool for professional symbolic analysis."
Post questions, share tips, and help other users.

A preprint server for health sciences.

Connect your AI agents to the web with real-time search, extraction, and web crawling through a single, secure API.

A large conversational telephone speech corpus for speech recognition and speaker identification research.

STRING is a database of known and predicted protein-protein interactions.

A free and open-source software package for the analysis of brain imaging data sequences.

Complete statistical software for data science with powerful statistics, visualization, data manipulation, and automated reporting in one intuitive platform.