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


Humdrum Exercise #18


For this exercise you will need to know the following new commands:

UNIX Commands Humdrum Commands
humsed
   

Change directories to /var/opt/Humdrum/Scores and answer the following questions. For each question, keep a record of both the answer, and the command(s) used to find your answer.

  1. Locate the sample of chorales by J.S. Bach containing **harm (harmony) information. What proportion of all chords is in first inversion? Second inversion? (N.B. You don't need humsed to answer this.)
    COMMAND:       extract -f 1 *.hrm | rid -GLId | grep -v = | wc 2877 2877 10243
    ANSWER:           There are 2,877 chords ...
    COMMAND:       extract -f 1 *.hrm | rid -GLId | grep -v = | grep -c b 821
    ANSWER:           There are 821 first inversion chords; 821 divided by 2877 is 0.285367 so 28.5 percent of chords are first inversion.
    COMMAND:       extract -f 1 *.hrm | rid -GLId | grep -v = | grep -c c 64
    ANSWER:           There are 64 second inversion chords; which is 2.2 percent.
  2. In the sample of chorales by J.S. Bach, what is the most common chord? (N.B. You don't need humsed to answer this.)
    COMMAND:       extract -f 1 *.hrm | grep -v = | rid -GLId | sort | uniq -c | sort -n
    ANSWER:           383 "I" chords; i.e. I chords in root position.
  3. Repeat the above question, but eliminate fermatas (pauses) before tabulating
    COMMAND:       extract -f 1 *.hrm | humsed 's/;//g' | grep -v = | rid -GLId | sort | uniq -c | sort -n
    ANSWER:           529 "I" chords
  4. Repeat the above question, but eliminate fermatas and ignore the chord's inversion.
    COMMAND:       extract -f 1 *.hrm | humsed 's/[bcd;]//g' | grep -v = | rid -GLId | sort | uniq -c | sort -n
    ANSWER:           722 "I" chords (ignoring inversion)
  5. Repeat the above question, but eliminate fermatas, ignore the chord's inversion, and ignore whether the chord is a 7th chord.
    COMMAND:       extract -f 1 *.hrm | humsed 's/[bcd;7]//g' | grep -v = | rid -GLId | sort | uniq -c | sort -n
    ANSWER:           732 "I" chords (ignoring inversions and sevenths)
  6. A dominant chord ("V") is surely the most common secondary chord (e.g. "V of"). What is the second most common secondary chord?
    COMMAND:       extract -f 1 *.hrm | rid -GLId | grep '/' | sort | uniq -c | sort -n
    ANSWER:           There are 13 instances of "viib/V".
  7. Repeat the above question, but eliminate fermatas, ignore the chord's inversion, and ignore whether the chord is a 7th chord.
    COMMAND:       extract -f 1 *.hrm | humsed 's/[bcd;7]//g' | rid -GLId | grep '/' | sort | uniq -c | sort -n
    ANSWER:           There are 19 instances of "vii/V" when inversion is ignored.
  8. BONUS QUESTION: In secondary chords (e.g. "V/iii") what is the most common target of the second chord? (In the example here, "iii" is the target of "V".)
    COMMAND:       extract -f 1 *.hrm | rid -GLId | grep '/' | humsed 's%.*/%%' | sort | uniq -c | sort -n
    ANSWER:           There are 176 instances of "X of V"; the second most common ... There are 72 instances of "X of vi".

Return to Exercises and Assignments Index
Return to Music 824 Index

This document is available at http://csml.som.ohio-state.edu/Music824/Exercises/exercise15.html