Overview
We propose a new algorithm for comparing digital music scores in various encodings (e.g. MusicXML or MEI). It is based on an intermediate abstract representation structured as labeled directed acyclic graphs (DAGs). Inspired by rhythm trees [1], these DAGs encode the metric and rhythmic structure of a score. Given two scores, after conversion into DAGs, our procedure calculates jointly:
- a list of differences — localised by time positions in the input scores;
- a time distance — cumulated duration of time intervals where scores differ;
- an edit distance based on attributes of notational elements not related to time, called surface distance.
The two later measures are normalised and combined into a similarity distance between scores.
The DAG's nodes are labelled with basic events (notes, rests, ...) for leaves, and, for inner nodes, by operators acting on time intervals, like splitting into sub-intervals of equal duration (in a tuplet), or one bar and the remaining, or concurrent voice creation. Node sharing represents composed events such as dotted notes. This way, every node corresponds to a time interval. For more details, see Description page.
The comparison proceeds first bar-wise, aligning equal bars, then by a recursive parallel descent into sub-DAGs representing differing bars, stopping as soon as labels diverge. This yields linear time complexity and provides more explicit feedback than the ins/del/replace operations of classical edit distances, with ad-hoc difference codes associated to each pair of node labels. The exact list of codes can be adapted to use-cases.
This approach can be applied e.g. to comparative corpus studies in musicology [2], or versioning in the context of score edition or preparation of corpora.
As a proof of concept, we propose two demos based on a corpus of piano sonatas [4], and transcriptions of monophonic soli on the same jazz standard by different performers [5].
Applications
Score versioning
A primary application of TSM Diff is comparing different versions of the same score, much like Git does for source code.
Comparative corpus studies
TSM Diff also supports comparative corpus studies in musicology [2], who is been applied to melodic similarity tasks.
Quantitative evaluation of MIR procedures
A key advantage is the clear independence of its sub-metrics [3], one related to timing (time distance) and one to other symbolic aspects (surface distance).
- Music transcription: note that pitch shifts of less than one measure can produce a high error rate, which is a known limitation in this context.
- Optical Music Recognition (OMR): evaluates the final score output of an OMR pipeline. However, the scores produced by OMR are often syntactically flawed (e.g. overfull measures), which can make direct comparison difficult; so evaluating the model's intermediate symbol output may be more informative.
Example Output
Below is a sample diff-list output for two versions of the same piece. Each row identifies one difference: its category, the time positions in the left and right scores (expressed as a number of bars, e.g. 2+1/4 means beat 1/4 after bar 2), the duration of the change, the number of TSM nodes involved, and the two distance values.
code left left left right right right l|r time symb cost
type start dur type start dur nodes dist dist cost
------------------------------------------------------------------------------------
0 CHORDS Chord3 2+1/4 1/4 Chord4 2+1/4 1/4 1|1 1/2 1 0.00067
1 CHORDS Chord2 2+1/4 1/4 Chord3 2+1/4 1/4 1|1 1/2 1 0.00067
2 FRAG Note_F3 6+1/2 1/2 Div2 6+1/2 1/2 1|1 1 1 0.00123
3 CONS Div2 8+1/4 1/8 Note_C5 8+1/4 1/8 1|1 1/4 1 0.00039
4 CONS Div2 11+1/2 1/2 Note_Bb3 11+1/2 1/2 1|1 1 1 0.00123
5 INS Artic 11+1/2 1/2 0|1 0 1 0.00011
6 REP Rest 18+3/8 1/8 Note_C5 18+3/8 1/8 1|1 1/4 1 0.00039
7 REP Div2 93+1/2 1/4 Rest 93+1/2 1/4 1|1 1/2 1 0.00067
8 INS Note_D6 93+3/4 3/16 Ornament193+3/4 0 1|1 0 2 0.00021
9 MULTI Multi 106 3/8 Chord2 106 3/8 2|1 3/4 1 0.00095
10 CHORDS Chord2 107+5/8 1/8 Chord2 107+5/8 1/8 1|1 1/4 1 0.00039
similarity= 0.9931179841354437Comparison of two versions of Mozart's Piano Sonata in B♭ major, KV 281 (K281-1 vs K281-1_01).
See the description of difference categories.
The following examples show two selected differences as they appear in the scores, with the relevant elements highlighted in yellow.
Diffs 0 & 1 — CHORDS at position 2+1/4, duration 1/4.
Both the treble and bass voices have a chord at this beat that differs.
Diff 2 — FRAG at position 6+1/2, duration 1/2.
In K281-1, a single F in the bass occupies this position.
In K281-1_01, that note is fragmented into two shorter notes, F then E,
covering the same total duration.
References
- Agon, C., Haddad, K., & Assayag, G. (2002). Representation and rendering of rhythm structures. Proceedings of the Second International Conference on Web Delivering of Music (WEDELMUSIC), pp. 109–113. IEEE.
- Nachtwey, A., Moss, F. C., & Plaksin, A. V. K. (2025). Beyond Bars: Distribution of Edit Operations in Historical Prints. Music Encoding Conference 2025 (poster) arXiv:2509.12786
- McLeod, A., & Steedman, M. (2018). Evaluating automatic polyphonic music transcription. Proceedings of the 19th International Society for Music Information Retrieval Conference (ISMIR), pp. 42–49.
- Hentschel, J., Neuwirth, M., & Rohrmeier, M. (2021). The Annotated Mozart Sonatas: Score, harmony, and cadence. Transactions of the International Society for Music Information Retrieval, 4(1). https://doi.org/10.5334/tismir.63
- Foster, D., & Dixon, S. (2021). Filosax: A dataset of annotated jazz saxophone recordings. Proceedings of the 22nd International Society for Music Information Retrieval Conference (ISMIR).
- Miller, W., & Myers, E. W. (1985). A file comparison program. Software: Practice and Experience, 15(11), pp. 1025–1040. Wiley.
- Foscarin, F., Jacquemard, F., & Fournier-S'niehotta, R. (2019). A diff procedure for music score files. Proceedings of the 6th International Conference on Digital Libraries for Musicology (DLfM).
- Foscarin, F., Jacquemard, F., & Fournier-S'niehotta, R. (2019). Computation and Visualization of Differences between two XML Music Score Files. 20th International Society for Music Information Retrieval Conference (ISMIR), Late Breaking Demo.
- Myers, E. W. (1986). An O(ND) difference algorithm and its variations. Algorithmica, 1(1–4), pp. 251–266. Springer.
- Martinez-Sevilla, J. C., Cerveto-Serrano, J., Luna-Barahona, N., Chapman, G., Sapp, C., Rizo, D., & Calvo-Zaragoza, J. (2025). Sheet Music Benchmark: Standardized Optical Music Recognition Evaluation. Proceedings of the 26th International Society for Music Information Retrieval Conference (ISMIR).
- Cogliati, A., & Duan, Z. (2017). A Metric for Music Notation Transcription Accuracy. Proceedings of the 18th International Society for Music Information Retrieval Conference (ISMIR), pp. 407–413.
- Suzuki, M. (2021). Score Transformer: Generating Musical Score from Note-level Representation. ACM Multimedia Asia, pp. 1–7.
- Nakamura, E., Benetos, E., Yoshii, K., & Dixon, S. (2018). Towards Complete Polyphonic Music Transcription: Integrating Multi-Pitch Detection and Rhythm Quantization. IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP).
- Hiramatsu, Y., Nakamura, E., & Yoshii, K. (2021). Joint Estimation of Note Values and Voices for Audio-to-Score Piano Transcription. Proceedings of the 22nd International Society for Music Information Retrieval Conference (ISMIR), pp. 278–284.
- Mongeau, M., & Sankoff, D. (1990). Comparison of musical sequences. Computers and the Humanities, 24(3), pp. 161–175. Springer.