Simple script to count symbols in mscz, mscx & musicxml files
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-11 13:53:02 +02:00
.gitignore git stuff :) 2026-09-11 13:53:02 +02:00
count_symbols.py v1.5.0 2026-09-11 13:49:39 +02:00
README.md git stuff :) 2026-09-11 13:53:02 +02:00
requirements.txt git stuff :) 2026-09-11 13:53:02 +02:00

count_symbols

Parses MuseScore (.mscx, .mscz) and MusicXML (.musicxml, .xml) score files and counts notational elements (notes, articulations, dynamics, lyrics, etc), grouped into weighted categories. Intended for pricing engraving / transcription work per element rather than per page or per hour.

Co-created by Claude AI

Install

pip install -r requirements.txt

Requires Python 3.8+.

Usage

python3 count_symbols.py score.mscx
python3 count_symbols.py score.mscz
python3 count_symbols.py *.mscz

Multiple files (including globs) are accepted. Each produces its own <name>_report.csv; running on multiple files also prints a grand summary at the end.

Options

--out PATH     CSV output path (single input file only)
-v, --verbose  show extra diagnostics (which .mscx was used inside a .mscz)
-q, --quiet    print only the grand total, skip category breakdown
--version      print version and exit

Categories and weights

  • note (0.5): notes and rests
  • symbol (1): articulations, slurs, ties, clefs, key/time signatures, ornaments, dynamics hairpins, tuplets, barlines, etc
  • text (2): dynamics text, expression text, tempo/metronome marks, lyric syllables

Weights are defined in WEIGHTS / CATEGORY_MAP / MSCX_CATEGORY_MAP near the top of count_symbols.py and can be adjusted directly.

Notes on formats

.mscz is a zip archive; the script extracts the main score .mscx from it automatically (linked parts under Excerpts/ are skipped). .mscx is MuseScore's native uncompressed XML and is the most reliable input, since MusicXML encodes spanning symbols (ties, slurs, hairpins) as separate start/stop elements, roughly doubling their count. When MusicXML is detected, symbol and text points are automatically halved to correct for this.

Any XML tag the script doesn't recognize is reported as "uncategorized" at the end of the run rather than silently dropped, so the category maps can be extended over time.

Output

CSV columns: category, tag, count, weight, points, followed by per-category subtotals and a grand total row.