Getting Started
This page covers installing TSM Diff and running the bundled example.
Requirements
- Python 3.12
music21,numpy,matplotlib,verovio,pypdf, pinned inrequirements.txtpytsmlight, a compiled C++ extension included inscripts/, with two platform builds:pytsmlight.cpython-312-x86_64-linux-gnu.so(Linux x86-64) andpytsmlight.cpython-312-darwin.so(macOS)
Installation
git clone https://gitlab.com/xiaobo-wang/tsm_diff_lbd.git cd tsm_diff_lbd pip install -r requirements.txt
Run your first comparison
From the scripts/ directory:
cd scripts python test.py
By default, test.py compares two versions of Mozart's Piano Sonata KV 281
(test/examples/K281-1.musicxml and test/examples/K281-1_01.musicxml) and prints the diff list.
Reading the output
Each row of the diff-list is one difference between the two scores:
| Column | Description |
|---|---|
code | The diff code |
left type / right type | Label of the TSM node on each side, e.g. Chord3, Note_F3 |
left start / right start | Position of the difference, in bars (e.g. 2+1/4 means beat 1/4 after bar 2) |
left dur / right dur | Duration of the affected interval, in bars |
l|r nodes | Number of TSM nodes involved on the left and right side |
time dist | Contribution to the time distance |
symb dist | Contribution to the surface distance |
cost | Combined weighted cost of this difference |
Diff codes, node labels, and the similarity formula (1 minus the harmonic mean of the two distances)
are all explained on the Description page.