Music Software Development

MusicXML measure duration checker

When a MusicXML file imports with extra rests, notes pushed into the next bar or measures marked as too long, the cause is usually a measure whose durations do not add up to its time signature. Open the file here to find every such measure. The checker reports the part, the measure and the voice, what length the time signature expects, what the file contains, and how far over or under it is. It only reads the file: nothing is changed and nothing is uploaded.

Checker

Or drag a file onto this box, or try a sample:

How the checker measures a bar

MusicXML gives each note a <duration> in divisions, the number of units per quarter note set in <attributes>. The checker reads each measure the way notation programs do, with a cursor that starts at the barline:

All arithmetic uses exact fractions, so triplets and unusual divisions never cause rounding errors. Lengths are reported in quarter notes, and differences also as note values, such as “an eighth note too long”.

Reading the results

Measure numbers are the ones written in the file. When a file numbers measures unusually (for example two measures called 1), the table also gives the measure’s position in the part.

Sample files

What it does not check

This is a timing check, not a full validation. It does not compare the file with the MusicXML schema, check pitches, beams or ties, or follow repeats. It reads uncompressed partwise files; a compressed .mxl file has to be exported uncompressed first. Measures in unmetered (senza-misura) time are listed but not measured. To learn the elements involved, see divisions and duration math and voices with backup and forward in MusicXML basics. To hear a file, convert it with the MusicXML to MIDI converter. The checking code is the tested module measure-check-core.mjs.