Image Processing Reference
In-Depth Information
3.1 Reading in Key and Divisions
First, FPC parses the key from each file, then the divisions. The number of divisions is an in-
teger value defining quarter note duration for the document. All other note types (half, eighth,
etc.) are deduced from this integer and recognized throughout the document. If a quarter note
is found to be two, a half note is four.
3.2 Reading in Notes
MusicXML organizes notes by layers within staves within measures. In other words, layer 1
of staff 1 of measure 1 comes before layer 2 of staff 1 of measure 1, which precedes layer 1 of
staff 2 of measure 1, and so on. Last is layer 2 of staff 2 of the final measure. If a staff contains
only one layer in a particular measure, the lower note of the two-note cluster (alto for staff 1,
bass for staff 2) is read before the upper note (soprano or tenor, respectively). Since a meas-
ure might contain a staff with one layer and another with two, FPC was carefully designed to
handle all possible combinations.
A note's pitch consists of a step and an octave (e.g., Bb and 3). A hash map is used to relate
pitches to integers (e.g., “Bb3” →18), and these integers are used to represent each voice of a
four-part Chord object.
3.3 Handling Note Values
In 3/4 and 4/4 time, a quarter-note-level harmonic rhythm means that chords change at most
each beat. Therefore, the chord produced by the arrangement of soprano, alto, tenor, and bass
voices at the start of each beat carries through to the end of the beat. This also means that short-
er notes moving between beats cannot command chords of their own. Quarter notes, which
span a whole beat, are then the ideal notes to capture as long as they fall on the beat, which
they always did. Likewise, eighth notes that fall on the beat are taken to be structurally im-
portant to the chord, so their durations are doubled to a full beat and their pitches captured,
whereas those that fall between beats are assumed to be passing tones, upper and lower neigh-
bors, and other nonchord tones, so they are ignored. For simplicity's sake, anything longer
than a quarter note is considered a repeat quarter note and sees its pitch captured more than
once. For instance, a half note is treated as two separate quarter notes and a whole note as
four separate quarter notes. A doted quarter note is assumed to always fall on the beat, so it
is captured as two quarter notes; the following eighth note is ignored. While it is possible for
something other than an eighth note to follow a dotted quarter, it is highly unlikely in 3/4 or
4/4, and it did not happen in any of the music used.
3.4 Results
Finally, for each XML file, FPC creates a Piece object comprising at the moment a key, classii-
er, and sequence of Chords. For each piece, it also produces a CSV file with the same informa-
tion. The CSV files serve purely as logs ( Figure 8 ) .
FIGURE 8 Flow chart for creating Piece objects.
 
Search WWH ::




Custom Search