Humdrum Extras

chorck manpage


COMMAND

    chorck -- Check for didactic errors in four-part choral textures.

SYNOPSIS

    chorck [options[input(s)[> output]

OPTIONS

-a Show the intermediate base-40 pitch array used in identifying rule violations.
-d Exclude sonorities with a two (double) note attacks or fewer from being considered in the rule analysis.
-f Display the filename on the warning line (useful for localizing violations when processing multiple files).
-l When the -a option is specified, also list the line in the input file from which the data array row was extracted. The -l option is ignored when -a is not used.
-p # Print the definition for the specified rule number. There are 8 rules; so for example, the meaning of rule 6 can be found by using the option: -p 6.
-s Exclude sonorities with a single note attack from being considered in the rule analysis.
-t Exclude sonorities with a three note attacks or fewer from being considered in the rule analysis.
-r list Apply only the listed rules. For example, to check for violations of only rules one and two, use -r 12. By default, input data will be checked against all eight rules.
-x list Exclude listed rules from being applied. For example, to check all rules except rule numbers one and two, use -x 12.
-w Show a list of warnings generated by the input data; not interleaving warnings into input musical data.
-m string Use string as the initial marker on the global comment reporting a rule violation. By default the marker is "Warning:". For example, to start the comment with the rule number, not printing the "Warning:" string, use the option: -m "".

DESCRIPTION

    Chorck checks four-part choral harmony exercises for common errors such as parallel 5th, octaves, hidden 5ths, etc. Chorales can be checked for eight types errors:

    1. Parallel 5ths between two voices when moving to different pitch classes.
    2. Parallel Octaves between two voices when moving to different pitch classes.
    3. Contrary parallel 5ths -- when two voices move in parallel 5ths displaced by an octave.
    4. Unequal 5ths -- when the bass part and another voice move from dim 5ths to perfect 5ths or vice versa.
    5. Hidden 5ths -- when the soprano moves in similar motion with another voice and the soprano leaps to a perfect 5th with that voice.
    6. Hidden 8va -- when the soprano moves in similar motion with another voice and the soprano leaps to a perfect octave with that voice.
    7. Voice crossing -- when an inner voice goes above the soprano voice or below the bass voice.
    8. Open spacing -- when the interval between successive voices other than the bass exceeds an octave.

    The input Humdrum data must contain four monophonic spines of **kern data. Non-kern spines will be ignored. If there are more than four **kern spines on a line, then the first four **kern spines are assumed to be the SATB voices and other **kern data after will be ignored. Errors are reported as global comments before the line on which offending error starts, and is of the form:

        !! Warning: <type>. <Error description and voicing location>
     

    As an example, the following music can be input into the chorck command:


    When the above data is run through the chorck command, four errors will be detected. In the example output below, blue text indicates the additional text added by the chorck command, and the bold red text indicates where the problem occurs. Dark red indicates the notes preceding rule-violating movements.

     **kern      **kern      **kern      **kern
     !bass       !tenor      !alto       !soprano
     *clefF4     *clefF4     *clefG2     *clefG2
     *k[f#c#g#]  *k[f#c#g#]  *k[f#c#g#]  *k[f#c#g#]
     *A:         *A:         *A:         *A:
     *M4/4       *M4/4       *M4/4       *M4/4
     !! Warning: 6. Hidden octave between soprano and bass
     2AA         2E          2A          2c#
     4E          4G#         4B          4e
     4AA         4E          4c#         4c#
     =2          =2          =2          =2
     4GG#        4B          4B          4d
     !! Warning: 1. Parallel 5th between tenor and soprano
     4AA         4A          4c#         4e
     !! Warning: 2. Parallel octave between bass and alto
     4D          4B          4d          4f#
     4E          4B          4e          4g#
     =3          =3          =3          =3
     4C#         4A          4e          4a
     !! Warning: 8. Open spacing between alto and tenor
     4AA         4E          4a          4cc#
     4D          4F#         4f#         4a
     4E          4E          4B          4g#
     =4          =4          =4          =4
     1AA         1A          1c#         1a
     ==          ==          ==          ==
     *-          *-          *-          *-
    If you want to know on what measure/beat a rule-violation starts, then try chorck in conjunction with hgrep:
          chorck file.krn  | hgrep Warning -mb
    Which will return this result for the above example input:

    Metrical considerations

    Chorck checks successive sonorities for rule violations; however, application of rules are also related to the metrical pattern. For example, The following example will pass all of the tests:

    In this case, when considering the notes falling on the beat, the bass and soprano parts play in parallel octaves from C to E. Chorck only checks successive sonorities, of which there are three in the example: (c e g cc), (c e g dd), and (e f g ee). But the D in the soprano is also a passing-tone between two more preceptually relevant sonorities which are occuring on the beat.

    To handle these types of cases in chorck, the offbeats can be removed by using the sample command, which will sample the music at quarter-note beats, and remove sonorities occurring off of the beats:

    sample file.krn

    The output from sample can then be sent to chorck for analysis, which will now be able to identify the parallel octave motion:

    sample file.krn | chorck

    Applying chorck directly to a Bach chorale (BWV 347) will identify 5 rule violations:

    measure beat rule
    2 3 5. Hidden 5th between soprano and tenor
    2 3 5. Hidden 5th between soprano and bass
    4 4 8. Open spacing between alto and tenor
    4 4.5 8. Open spacing between alto and tenor
    8 4.5 6. Hidden octave between soprano and tenor

    Compare the above results to the following analysis which is created by first filtering the chorale through the sample command, which removes two violations and adds three new ones:

    measure beat rule
    2 3 5. Hidden 5th between soprano and tenor
    2 3 5. Hidden 5th between soprano and bass
    4 4 8. Open spacing between alto and tenor
    8 4 6. Hidden octave between soprano and tenor
    10 2 5. Hidden 5th between soprano and alto
    12 3 2. Parallel octave between tenor and soprano

    Selective sonority exclusions

    Instead of pre-processing chorale music with sample, a more generalized method of determining if any particular sonority is perceptually relevant would be to require a certain number of note attacks in that sonority. Perhaps the best method is to removed all sonorities which contain only one note attack from being considered by the chorck command. This can be done with the -s option.

    Below is a comparison of using chorck with and without the -s option. When not specifying the -s option, the parallel octave motion in the bass and soprano voices is not detected. But when applying the -s option, the intermediate sonority with only a single note attack on D5 in the soprano voice is ignored, and the parallel octave motion is found:

    chorck file.krn

    chorck -s file.krn

    The chorck command also has options for ignoring double note-attack sonorities (-d) where only sonorities with three or four note attacks will be considered in the analysis. An option for ignoring triple note-attack sonorities as well (-t) will prevent any sonorities less than all four voices staring at the same time from being considered in the analysis.

    Rests and the -s, -d, -t options

    When determining the number of voices with the -s, -d or -t options, rests are treated equal to notes. Consider the following examples:

    chorck -s file1.krn

    chorck -s file2.krn

    In the first example, the -s option was able to suppress the second line of the data where only the soprano is starting a new note and the other three voices are holding previously sung notes. In the second example, the second line does have a single note being started, but the other three voices are starting rests, and therefore the program will not exclude that line because of the breaks in the continuity of the voices. In the second case, it becomes perceptually relevant that there is only a single note being played in isolation in the second line of data, and the linkage between the first and third lines of data are weakened.

    Applying chorck on Bach chorales

    Try applying chorck to the data for 370 Bach four-part chorales from the KernScores website. First, you can count the number of rule violations separated out by subcategory of which voices are involved, using this command pipeline:
         chorck *.krn | grep Warning | sort | uniq -c | sort -nr 
    The results shown below demonstrate that open spacing between the alto and tenor are the most common rule that Bach violates in the chorales, and this occurs three times more often than open spacing between the alto and soprano voices. Parallel fifths or octaves are the least common of the rule violations:
         338 !! Warning: 8. Open spacing between alto and tenor
         329 !! Warning: 7. Voice crossing between tenor and bass
         202 !! Warning: 5. Hidden 5th between soprano and alto
         191 !! Warning: 5. Hidden 5th between soprano and tenor
         174 !! Warning: 6. Hidden octave between soprano and tenor
         156 !! Warning: 7. Voice crossing between soprano and alto
         103 !! Warning: 8. Open spacing between soprano and alto
          98 !! Warning: 5. Hidden 5th between soprano and bass
          84 !! Warning: 7. Voice crossing between alto and bass
          78 !! Warning: 7. Voice crossing between soprano and tenor
          46 !! Warning: 6. Hidden octave between soprano and bass
          37 !! Warning: 4. Unequal 5th between bass and soprano
          32 !! Warning: 4. Unequal 5th between bass and alto
          24 !! Warning: 4. Unequal 5th between bass and tenor
          23 !! Warning: 6. Hidden octave between soprano and alto
          19 !! Warning: 3. Contrary parallel 5th between bass and alto
          18 !! Warning: 3. Contrary parallel 5th between tenor and soprano
          14 !! Warning: 1. Parallel 5th between tenor and soprano
          12 !! Warning: 1. Parallel 5th between tenor and alto
          11 !! Warning: 3. Contrary parallel 5th between bass and tenor
           7 !! Warning: 3. Contrary parallel 5th between bass and soprano
           6 !! Warning: 3. Contrary parallel 5th between tenor and alto
           4 !! Warning: 1. Parallel 5th between bass and soprano
           3 !! Warning: 2. Parallel octave between bass and alto
           3 !! Warning: 1. Parallel 5th between bass and tenor
           2 !! Warning: 2. Parallel octave between bass and tenor
           2 !! Warning: 1. Parallel 5th between bass and alto
           2 !! Warning: 1. Parallel 5th between alto and soprano
           1 !! Warning: 2. Parallel octave between tenor and soprano 

    Next, you can check to see how often in the chorales the eight rules that chorck checks for are violated using this command pipeline:

           chorck *.krn | grep Warning | sed 's/\..*//' | sort | uniq -c 
    Which will give the following answer saying that the parallel-octaves rule is the rule Bach violates the least, while hidden-fifths, voice-crossing, and open-spacing rules are the ones he violates the most:
          37 !! Warning: 1 (parallel 5ths)
           6 !! Warning: 2 (parallel octaves)
          61 !! Warning: 3 (contrary parallel 5ths)
          93 !! Warning: 4 (unequal 5ths)
         491 !! Warning: 5 (hidden 5ths)
         243 !! Warning: 6 (hidden octaves)
         647 !! Warning: 7 (voice crossing)
         441 !! Warning: 8 (open spacing)
     
    These counts can be put into perspective by dividing by the total number of sonorities present in the chorales. The sonority count can be measured by counting the lines of data in the chorales, excluding lines which contain barlines, which will return a count of 30276:
           rid -GLId *.krn | grep -vc = 
     
    count    frequency   rule
    37 0.1%   1. parallel 5ths
    6 0.02%    2. parallel octaves
    61 0.2%    3. contrary parallel 5ths
    93 0.3%   4. unequal 5ths
    491 1.6%    5. hidden 5ths
    243 0.8%    6. hidden octaves
    647 2.1%    7. voice crossing
    441 1.6%    8. open spacing
    20196.7%    all rules

    Fermatas (denoted by a semicolon in **kern data) consistently marks phrase boundaries in the chorales, so the rule violations can be separated between phrase endings and the rest of the phrase. To count the number of rules triggered at phrase boundaries, the following command pipeline can be used:

         chorck *.krn | grep -A 1 Warning | grep -c ';' 
    The above command will find 306 rule violations at phrase boundaries, which is 306/2019 = 15% of the total violations. To count the number of phrases (3120), use this command (in a bash shell):
         for i in *.krn; do extract -f1 $i | hgrep ';'; done | wc -l 
    The above command extracts the bass voice from each file and then searches for fermatas. Fermatas cannot be searched for in the full-voice texture because sometimes voices have extra notes before ending on a fermata note. This means that rule-violations occur about 50% more often at phrase boundaries compared to inside of phrases: 306/3120 = 9.8% at boundaries compared to (2019-306)/(30276-3120) = 6.3% at other locations in the phrase. (Excluding rules 7 and 8, which rarely occur at phrase boundaries, from the comparison will increase the difference).

    Here is a command pipeline which counts the number of rule violations by rule at the phrase boundaries:

         for r in 1 2 3 4 5 6 7 8; do echo "rule $r:"; chorck *.krn -r $r \
             | grep -A 1 Warning | grep -c ';'; done 
    Which returns these results:
           rule 1:  12     (parallel 5ths)
           rule 2:   4     (parallel octaves)
           rule 3:  22     (contrary parallel 5ths)
           rule 4:  21     (unequal 5ths)
           rule 5: 165     (hidden 5ths)
           rule 6:  85     (hidden octaves)
           rule 7:  15     (voice crossing)
           rule 8:   4     (open spacing) 

    Separating the total counts into phrase-middles and phrase-endings for each rule:

    total phrase-ending phrase-middle       rule
    37 12 (32%) 25 (68%)       1. parallel fifths
    6 4 (67%) 2 (33%)       2. parallel octaves
    61 22 (36%) 39 (64%)       3. contrary parallel 5ths
    93 21 (23%) 72 (77%)       4. unequal 5ths
    491 165 (34%) 326 (66%)       5. hidden 5ths
    243 85 (35%) 158 (65%)       6. hidden octaves
    647 15 (  2%) 632 (98%)       7. voice crossing
    441 4 (  1%) 437 (99%)       8. open spacing

    Note in particular that rules 7 & 8 (voice crossing and open spacing) are only violated by Bach in the middle of phrases, and extremely rarely at the ends of phrases at fermatas. Next, it is useful to display the relative frequency of rule violations by the occurrence of each type of sonority (all, phrase-ending, phrase-middle):

    total/30276 endings/3120 middles/27156 e/m ratio       rule
    0.12% 0.38% 0.09% 4.2         1. parallel fifths
    0.02% 0.13% 0.01% 13            2. parallel octaves
    0.20% 0.71% 0.14% 5.1         3. contrary parallel 5ths
    0.31% 0.67% 0.27% 2.5         4. unequal 5ths
    1.62% 5.29% 1.20% 4.4         5. hidden 5ths
    0.80% 2.72% 0.58% 4.7         6. hidden octaves
    2.14% 0.48% 2.33% 0.2         7. voice crossing
    1.46% 0.13% 1.61% 0.08         8. open spacing

    Rules 1-6 are more common to occur at phrase boundaries, while rules 7 & 8 are more common to occur at phrase boundaries. In particular, parallel octaves are thirteen times more likely to occur at phrase boundaries than at other locations in a phrase; while open spacing is thirteen times more likely to occur in the middle of phrases rather than at phrase boundaries.

    Refined analysis with the -s option

    The -s can be used to filter out intermediate sonorities which can hide musically relevant violations of rules 1-6 (which examine the voice relationships across two sonority regions). To count the number of sonorities which do not contain single note-attacks, try this command (in a bash shell) which will count 22267 sonorities (as compared to 30276 sonorities when including ones with single-note attacks in the previous section).
         for i in *.krn; do chorck -as $i; done | wc -l 
    The -a option will list the sequence of pitches being examined in base-40 pitch notation, with the number of rows equivalent to the number of sonorities. When examining these 22267 sonorities, 1580 rule violations were found, which is an overall rate of 7.1%:
         chorck -s *.krn | grep -c Warning 
    Counts of the individual rule violations can be done as before with this command pipe line:
         chorck -s *.krn | grep Warning | sed 's/\..*//' | sort | uniq -c
         113 !! Warning: 1 (parallel 5ths)           0.51%
           9 !! Warning: 2 (parallel octaves)        0.04%
          80 !! Warning: 3 (contrary parallel 5ths)  0.36%
          98 !! Warning: 4 (unequal 5ths)            0.44%
         487 !! Warning: 5 (hidden 5ths)             2.19%
         252 !! Warning: 6 (hidden octaves)          1.13%
         219 !! Warning: 7 (voice crossing)          0.98%
         322 !! Warning: 8 (open spacing)            1.45% 
    Counts for phrase boundary rule violations can be done with this command pipeline (which is better than the simpler method given in the previous section):
        for r in 1 2 3 4 5 6 7 8; do echo "rule $r:"; chorck *.krn -s -r $r \
           | grep -A 1 Warning | grep -c ';'; done
     
           rule 1:  16      (parallel 5ths)
           rule 2:   4      (parallel octaves)
           rule 3:  23      (contrary parallel 5ths)
           rule 4:  21      (unequal 5ths)
           rule 5: 164      (hidden 5ths)
           rule 6:  85      (hidden octaves)
           rule 7:   9      (voice crossing)
           rule 8:   4      (open spacing) 
    With the above violation counts, a similar summary table as in the prevous section, but probably more musically accurate, can be constructed:

    total/22267 endings/3120 middles/19147 e/m ratio       rule
    0.51% 0.51% 0.44% 1.2       1. parallel fifths
    0.04% 0.12% 0.02% 6.0       2. parallel octaves
    0.36% 0.74% 0.26% 2.8       3. contrary parallel 5ths
    0.44% 0.67% 0.35% 1.9       4. unequal 5ths
    2.19% 5.26% 1.47% 2.4       5. hidden 5ths
    1.13% 2.72% 0.76% 3.6       6. hidden octaves
    0.98% 0.29% 0.96% 0.3       7. voice crossing
    1.45% 0.12% 1.45% 0.08       8. open spacing

    Open spacing is one of the two most common rule violations, but it is 12 times more commonly found in the middle of phrases as compared to phrase endings. Also parallel octaves, which is the least-commonly violated rule, occurs 6 times more often at phrase boundaries as compared to the middle of phrases. Again, all rule violations occur more often at phrase boundaries, except for rules 7 and 8.

EXAMPLES

ONLINE DATA

    Input arguments or piped data which are expected to be Humdrum files can also be web addresses. For example, if a program can process files like this:
           program file.krn
    It can also read the data over the web:
           program http://www.some-computer.com/some-directory/file.krn
    Piped data works in a somewhat similar manner:
           cat file.krn | program
    is equivalent to a web file using ths form:
           echo http://www.some-computer.com/some-directory/file.krn | program

    Besides the http:// protocol, there is another special resource indicator prefix called humdrum:// which downloads data from the kernscores website. For example, using the URI humdrum://brandenburg/bwv1046a.krn:

          program humdrum://brandenburg/bwv1046a.krn
    will download the URL:
    Which is found in the Musedata Bach Brandenburg Concerto collection.

    This online-access of Humdrum data can also interface with the classical Humdrum Toolkit commands by using humcat to download the data from the kernscores website. For example, try the command pipeline:

          humcat humdrum://brandenburg/bwv1046a.krn | census -k

REFERENCES

    The eight rules checked by chorck are listed in:

  • Stefan Kostka and Dorthy Payne. Tonal Harmony with an Introduction to Twentieth-Century Music, 3rd. ed. McGraw-Hill: New York; 1995. (Chapter 5: Principles of Voice Leading)

DOWNLOAD

    The compiled chorck program can be downloaded for the following platforms:
    • Linux (i386 processors) (dynamically linked) compiled on 28 Jun 2012.
    • Windows compiled on 29 Jun 2012.
    • Mac OS X/i386 compiled on 13 Nov 2013.
    • Mac OS X/PowerPC (version 10.2 and higher) compiled on 13 May 2009.

    The source code for the program was last modified on 12 Jun 2009. Click here to go to the full source-code download page.