The humdiff filter automatically identifies and marks differences between two or more scores of the same music having the same duration. The filter is useful for data validation when encoding scores using double data-entry method as well as preparations of critical editions.
Here are two example scores with some differences:
The humdiff filter identifies differences between the two scores and will highlight notes in the first score that are different from those in the second score:
Notice that the humdiff filter requires two (or more) data segments,
and the filtering command must start with four !!!!
, indicating
that the filter applies to multiple data segments.
Reference score
By default, the humdiff filter will use the first data segment as the reference score against which all of the other data segments will be compared. The reference score will be displayed with highlighted notes showing where other scores have different pitches.
The -r
option selects a different score in the Humdrum data stream
to use as the reference when it does not occur first. Here is an
example of the same two scores being compared, but now the second
score in the data stream is used as the reference score:
Notice that the black notes in the resulting graphical score match between the two versions of the music. The highlighted notes are different, and those of the reference edition are displayed.
An alternate method for selecting the reference score is to use the chooser filter. This filter rearranges the order of data segments within a stream of Humdrum data:
Multiple score comparisons
The humdiff filter can compare multiple scores to a reference score, provided that all scores have the same duration. Any note in the reference score that differs from a comparison score will be highlighted. Here is an example of three scores, with each having one difference with the reference score. The first score is a C-major scale, the second one adds a sharp onto the F, and the third adds a flat on the A. This causes the F and A in the original score to be highlighted:
Try changing the reference score in the above example, such as adding -r 2
to the filter line in the above text.
Highlighting color
The -c
option can be used to set the highlighting color. The color
can be any SVG/HTML color name or hex color.
Try setting the color to hotpink
and #ff8800
.
Chopin mazurka example
Here is an example comparing the last two measures of Chopin’s mazurka in B minor, op 30/2, between two different first editions:
- Breitkopf & Härtel
- Maurice Schlesinger
In the first comparison, the B&H score is the reference, with red notes indicating differences from the Schlesinger edition:
And in the following comparison, the Schlesinger edition is the reference, with green notes being different from the B&H edition: