Music 824: Computer Applications in Music Research
Ohio State University
School of Music


Humdrum Exercise #14 - Answers


All of the following commands assume that you are located in the appropriate score directory.

  1. How long (in seconds) is Bach's Invention No. 2?
    COMMAND:     extract -f 1 inven02.krn | dur -x | grep -v = | rid -GLId | stats
    ANSWER:         117 seconds
  2. How long (in seconds) is Bach's Invention No. 1?
    COMMAND:     extract -f 1 inven01.krn | dur -x | humsed 's/ .*//' | grep -v = | rid -GLId | stats
    ANSWER:         89 seconds [not 93 or 97 seconds] (Notice that Invention No. 1 has multiple stops for the final chord.)
  3. How long is Bach's Invention No. 2 with a metronome setting of 58 quarter-notes per minute?
    COMMAND:     extract -f 1 inven02.krn | dur -x -M 58 | grep -v = | rid -GLId | stats
    ANSWER:         111.7 seconds
  4. Bach's Invention No. 6 is written in binary form with repeats indicated. What is the duration of Invention No. 6 without any repeats?
    COMMAND:     thru -v norepeats inven06.krn | extract -f 1 | dur -x | grep -v = | rid -GLId | stats
    ANSWER:         99 seconds
    How long is it with both repeats?
    COMMAND:     thru -v allrepeats inven06.krn | extract -f 1 | dur -x | grep -v = | rid -GLId | stats
    ANSWER:         186 seconds
  5. What is the duration of Invention No. 6 when played with the first repeat only?
    COMMAND:     yank -s A -r 1 inven06.krn > temp1
    COMMAND:     yank -s B -r 1 inven06.krn > temp2
    COMMAND:     cat temp1 temp1 temp2 | extract -f 1 | dur -x | grep -v = | rid -GLId | stats
    ANSWER:         131 seconds
    What is the duration of Invention No. 6 (without repeats) when the first section is performed at 54 quarter-notes per minute and the second section is performed at 57 quarter-notes per minute?
    COMMAND:     yank -s A -r 1 inven06.krn | extract -f 1 | dur -x -M 54 | grep -v = | rid -GLId | stats
    COMMAND:     yank -s B -r 1 inven06.krn | extract -f 1 | dur -x -M 57 | grep -v = | rid -GLId | stats
    ANSWER:         33.3 + 66.3 = 99.6 seconds
  6. Using the Swedish folksong collection, determine the total duration of the rests in the first song.
    COMMAND:     yank -m r -r 0 sverig01.krn | dur -x | rid -GLId | grep -v = | stats
    ANSWER:         3 seconds at 60 quarters/minute
  7. In the first Swedish folksong, what is the total duration of all leading-tone pitches?
    COMMAND:     solfa -x sverig01.krn > temp1
                                dur -x sverig01.krn > temp2
                                assemble temp1 temp2 | yank -m ^so -r 0 | extract -f 2 | grep -v = | rid -GLId | stats
    ANSWER:         1.5 seconds

Return to Music 824 Index