Expand description
Correcting the rhythm of a score read by optical music recognition:
music21’s omr.correctors.
A measure whose notes do not fill its bar was most likely misread. The correctors look for the measure that most likely stands where it should – another measure of the same part a likely distance away whose rhythm differs from it in likely ways (the horizontal model), or the measure at the same place in another part that tends to move with it (the vertical model) – and put that measure’s rhythm in its place, keeping its pitches.
Rhythms are compared as text: each note, chord or rest of a measure is
one character for its length, notes on even codes and rests on odd
ones (measure_hash).
Structs§
- Measure
Relationship - A flagged measure and the measure found to correct it, with how likely
the correction is: music21’s
MeasureRelationship. - Opcode
- One step of turning one sequence into another: Python’s opcode
(tag, i1, i2, j1, j2), the first sequence’s itemsi1..i2and the second’sj1..j2. - Priors
Integration Score - How many flagged measures were corrected, and by which model: music21’s
PriorsIntegrationScore. - Score
Corrector - A score being corrected, part by part: music21’s
ScoreCorrector. - Single
Part - One part of a score being corrected, its measures’ rhythms and those
flagged: music21’s
SinglePart.
Enums§
- Opcode
Tag - What one stretch of an
Opcodedoes to turn the first sequence into the second: Python’s opcode tags.
Constants§
- PROBABILITY_
ON_ ADDITION - How likely a note is read that is not there: music21’s
getProbabilityOnAddition. - PROBABILITY_
ON_ EQUALITY - How likely a note is read right: music21’s
getProbabilityOnEquality. - PROBABILITY_
ON_ OMISSION - How likely a note is missed: music21’s
getProbabilityOnOmission.
Functions§
- measure_
difference - How unlike two rhythms are, as music21’s
getMeasureDifferencehas it: one less theirdiffliblikeness, except that the same rhythm is as unlike as can be, one. - measure_
hash - The rhythm of a measure as text, a character for each note, chord or
rest, as music21’s
MeasureHash.getHashStringwrites it. A measure holding voices is chordified first. - opcodes
- The steps that turn one rhythm into another: Python’s
difflibopcodes, music21’sgetOpCodes. - probability_
based_ on_ changes - How likely
otherwas misread asown, from the steps that turn the one into the other: music21’sgetProbabilityBasedOnChanges. Each equal note isPROBABILITY_ON_EQUALITY, each one missedPROBABILITY_ON_OMISSION, each one addedPROBABILITY_ON_ADDITION, and a stretch replaced isprobability_on_substitute. - probability_
from_ one_ char_ sub - How likely one length was misread as another: music21’s
getProbabilityFromOneCharSub. A length doubled or halved any number of times is 0.0165 for each; a rest read for a note of the same length an addition, the other way an omission; a note read as a rest 0.003; and anything else an omission and an addition at once. - probability_
on_ substitute - How likely the rhythm
sourcewas misread asdestination: music21’sgetProbabilityOnSubstitute. The longer is cut to the shorter, each character cut an addition or an omission, and the rest compared character by character (probability_from_one_char_sub).