Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LMXE — Linearized MusicXML Extended

LMXE is a symbolic music score format library that extends Linearized MusicXML (LMX) with multi-part/multi-staff support, an optional YAML metadata header, and part-by-part and reduced token-set variants. It converts MusicXML scores to and from a compact, whitespace-tokenized text representation suitable for training sequence-to-sequence Optical Music Recognition (OMR) models, and it ships evaluation utilities (OMR-NED, TEDn, SER) for scoring OMR predictions. LMXE is derived from OMR-Research/lmx (© 2024 Jiří Mayer).

If you want to build on or redistribute this code, see the Licenses and Citation sections below.

Part of the String Quartet OMR Benchmark

A Dataset and Benchmark for Optical Music Recognition of String Quartet Scores
Dongmin Kim, Brian Liu, Jose J. Valero-Mas, Dasaem Jeong
Proceedings of the 27th International Society for Music Information Retrieval Conference (ISMIR), 2026

This repository provides the LMXE format implementation itself — linearization/delinearization between MusicXML and LMXE, the metadata schema, and the evaluation metrics — used across the rest of the benchmark.

  • string-quartet-omr-benchmark: umbrella entry point for the paper and the full repository constellation.
  • ossq-omr: the OSSQ-OMR dataset — MuseScore/MusicXML annotation sources and their revision history.
  • omr-data-preprocessor: the preprocessing pipeline that builds every derived symbolic format from the dataset sources.
  • sqomr: model training and evaluation experiments.
  • lmxe: the LMXE symbolic format library (derived from OMR-Research/lmx). (this repository)

Installation

Requires Python 3.10 or later.

pip install git+https://github.com/MALerLab/lmxe.git

or, from a local checkout:

pip install -e .

Formats

LMXE files are plain-text token sequences (vocabulary defined in lmxe/vocabulary.py) with an optional YAML metadata header, separated from the token sequence by a --- line. The metadata records score_type (single, multi, grandstaff, or mixed), dataset/score identifiers, page and system indices, measure numbers, and which time/key/clef signatures were injected during linearization.

  • LMXE (.lmxe) — the base format. Each file represents a single musical system; tokens are grouped measure by measure, with every part's tokens nested inside its measure via part: markers.
  • PLMXE (.plmxe) — a partwise reorganization of the same content: measures are grouped by part instead of interleaved across parts. Obtained from an LMXEFile with .get_part_by_part().
  • RLMXE (.rlmxe) — a reduced variant with injected stem-direction and time-signature tokens stripped out, intended for training sequence models on a smaller vocabulary. Obtained from an LMXEFile with .get_reduced().

Usage

from lmxe import linearize_lmxe, delinearize_lmxe, LMXEFile

# MusicXML -> LMXE: returns a list of pages, each a list of per-system LMXEFile objects
pages = linearize_lmxe(xml="score.musicxml")
system = pages[0][0]
system.write("score.lmxe", include_metadata=True)

# LMXE -> MusicXML
lmxe_file = LMXEFile.load("score.lmxe", include_metadata=True)
musicxml = delinearize_lmxe(lmxe_file, score_type=lmxe_file.metadata.score_type)
musicxml.write("score_roundtrip.musicxml")

# Derive the partwise / reduced variants of a system
plmxe_file = system.get_part_by_part()
rlmxe_file = system.get_reduced()

lmxe.evaluation provides scoring utilities for OMR predictions: calc_omr_ned (a music21/musicdiff-based normalized edit distance), TEDn_lmx_xml (tree edit distance between predicted LMX and gold MusicXML), and calc_ser_metric (token-level symbol error rate).

Citation

If you use LMXE as part of the String Quartet OMR Benchmark, please cite:

@inproceedings{Kim2026sqomrbench,
    title     = {A Dataset and Benchmark for Optical Music Recognition of String Quartet Scores},
    author    = {Dongmin Kim and Brian Liu and Jose J. Valero-Mas and Dasaem Jeong},
    year      = 2026,
    booktitle = {Proceedings of the 27th International Society for Music Information Retrieval Conference (ISMIR)},
}

Please also cite the upstream LMX paper this repository extends:

@inproceedings{mayer2024lmx,
    title     = {Practical End-to-End Optical Music Recognition for Pianoform Music},
    author    = {Mayer, Ji{\v{r}}{\'\i} and Straka, Milan and Haji{\v{c}} jr., Jan and Pecina, Pavel},
    year      = 2024,
    booktitle = {18th International Conference on Document Analysis and Recognition (ICDAR 2024)},
    pages     = {55--73},
    doi       = {10.1007/978-3-031-70552-6_4},
}

Licenses

Source code in this repository is available under the MIT license (see LICENSE.txt). LMXE derives from the original LMX implementation by Jiří Mayer (OMR-Research/lmx, also MIT); the LMXE extensions are copyright MALer Lab, Sogang University.

About

LMXE: Linearized MusicXML Extended — symbolic score format library used by the OSSQ-OMR benchmark (derived from OMR-Research/lmx)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages