Each sonority is identified, if possible, as a chord built on thirds. In this example, only the pitch-class set "C G B D" cannot be categorized:
The following table lists the types of chordal sonorities that the program will identify. Following each type is an example set of pitch classes for that type of chord.
The -t, -i, and -r options output only the specified portion of the sonority's quality (type, inversion and root respectively).
The -f option can be used to format the output. Use "t" for printing the sonority type, "i" for the inversion, and "r" for the root. These characters can be reordered, and a different separation character can be used:
Sonority pitch classes
The -U option will print a list of the pitch classes present in an uncategorized sonority which are enclosed in square brackets following the "X" symbol, sorted diatonically stating with C:
Instead of interpreting the chordal quality of a sonority, you can print the pitch-class components of the sonority with the -n option. If the sonority can be categorized, the pitches will be listed in triadic order, starting at the root; otherwise, the pitches will be in alphabetical order starting with C. The lowest note in the sonority is listed in uppercase. If the sonority cannot be identified, the diatonic pitch-class name is doubled. Pitch classes which are sustained from previous sonorities are placed within parentheses, such as "(a)".
The -s option will suppress printing of sonorities which contain sustained pitch classes held over from previous sonorities. In the following example, the first call to sonority places the chord root and sonority type in the first appended column. The next column contains the data generated with sonority -nas which excludes sonorities which do not have note attacks on all constituent pitch classes, and the last column contains the data generated by sonority -na which includes pitch classes from previous sonorities in parentheses:
The -o option can be used to remove the identification of the bass note in the pitch-class sonority description.
for i in chor???.krn; do sonority -t $i | grep -v = | rid -GLId | sort | uniq -c \ | sort -nr > `basename $i .krn`.son ./makecoord `basename $i .krn`.son done > data
Note the unusual minor outlier with a 48% major and 7% minor sonority composition. This is chorale 75: Das walt mein Gott. It is a short chorale with only 11 measures. The pickup beat is a D minor chord establishing the tonality, but the music quickly modulates to the relative major (F major) in the second beat of the chorale which lasts until a modulation back into D minor in measure 9.
The most "sonorous" chorale is #102: Du lebensfürst, Herr Jesu Christ which contains 82.3% triadic sonorities (68.6% major, 13.7% minor). The most dissonant chorale is #339: Wer nur den lieben Gott laßt walten which contains 37.6% triadic sonorities (24.6% major, and 13% minor). Statistical descriptions of the major and minor key clusters in the plot above:
The following histograms show the relative frequencies of major and minor triads in various inversions in all of the sonorities in 370 Bach chorales. For both major and minor triads, the root inversion is the most common at about 2/3 of the occurrences. First inversions occur about 1/3 of the time for each type of triad, and second inversions occur much less often in both types of triads. An interesting difference between the two triad types is that the second inversion is about two times more common for minor triads than for major ones.
How to calculate data for the above chart:
sonority chor???.krn -f t:i | grep ^min: | sort | uniq -c
Example 3There are three augmented-sixth chord sonorities in the 370 Bach chorales. You can locate them with this bash shell command:
for i in chor???.krn; do sonority -ta $i | ditto -p > `basename $i .krn`.temp done hgrep -Hbm "french|german|italian" *.tempThere is an Italian sixth chord in chorale #19, first measure, offbeat of the second beat; a French sixth on beat 2.4 of measure 4 in chorale #146; and a German sixth on the 1.5 beat of measure 10 in chorale #340. The notes in parentheses (added by the ditto command) are held over from previous sonorities in the music.
You can view the functional position of the chords in the overall tonality of each chorale by transposing the chorales to C major/minor before (or after) doing the sonority analysis:
for i in chor???.krn; do transpose -k c $i | sonority -ta | ditto -p > `basename $i .krn`.temp done hgrep -Hbm "french|german|italian" *.tempIn all three cases, the root of the augmented sixth chord occurs as expected on the flatted sixth scale degree (A-flat in C major).
You can identify the sonority which follows the augmented sixth chord by doing this command:
egrep -A 1 "french|german|italian" chor???.temp
In chorales which are in a minor key, the following plot shows the relative occurrence of major and minor triads on various scale degrees. For minor chorales, the most common triad is minor on the tonic scale degree. Only two other scale degrees are commonly used for minor triads in the minor chorales: the subdominant and the dominant. About 1/3 of dominant triads are minor, while the other 2/3 are major (with the harmonic minor VIIth scale degree used for the third of the dominant).
Major triads occur most often on the mediant (III), which primarily indicates a modulation to the relative major. Likewise, major chords on the leading tone (VII) are common, where they typically act as dominants in the relative major key. Submediant (VI) chords are very rare in the minor chorales.
Data was extracted for the above plots by first separating major and minor chorales which can be accomplished with the help of grep or hgrep:
hgrep -Dlkt '^\*[a-g][#-]?:' *.krn # list of chorales with minor keys hgrep -Dlkt '^\*[A-G][#-]?:' *.krn # list of chorales with major keysThen running these bash shell commands on the two separate sets:
for i in chor???.krn; do transpose -kc $i | sonority -f t:r | grep -v = | rid -GLId done | sort | uniq -c | sort -k2 > minor.dat
For chorales in a major key, the most common triadic sonority is the tonic, followed by the dominant (70% compared to tonic), then the Subdominant (35% compared to tonic). The most common minor triad sonorities occur on the Submediant (VI) at 1/3 the rate of tonic triads, followed by the supertonic (II) at 1/4 the rate of tonic triads.
Major triads on the supertonic typically function as the dominant of the dominant (V/V), and these are the 4th most common major triad sonorities. Major chords on the mediant are most likely acting as dominants of the submediant.
for i in chor???.krn; do transpose -kc $i | sonority -f t:r | grep -v = | rid -GLId done | sort | uniq -c | sort -k2 > major.dat
First-order sonority transitions in Bach chorales. The following list shows the most common sonotory-to-sonority transitions in the Bach chorales (29,906 total sonority pairs):
The data for the above table was extracted with the bash shell command:
for i in chor???.krn; do transpose -kc $i | sonority -nN, | grep -v = \ | context -n2 | rid -GLId done | sort | uniq -c | sort -nr > output.dat
More example usages of the sonority program are available on the sonority examples page
program file.krnIt can also read the data over the web:
program http://www.some-computer.com/some-directory/file.krnPiped data works in a somewhat similar manner:
cat file.krn | programis 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.krnwill download the URL:
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