Tutorial Sheet Music Part 2: Statistics

(version 2022_01_03)

Table of contents:

  1. Retrieval of metadata and basic statical information.
  2. Frequencies: Pitch, pitch classes, pitch durations, metric accents.
  3. Intervals in monophonic voices
  4. Two-dimensional frequency distributions
  5. Tasks

In this tutorial, you will learn about basic computer-based statistical queries using music examples.

Working through the following tutorial should enable you to examine your own music examples (sheet music files) as well as to make comparisons between different pieces of music. This always involves the formulation of certain analytical questions and the interpretation of the respective results.

Now, please, load the Kyrie from "Missa La sol fa re mi" of Josquin (Jos1102):

You can also listen to the piece - but only in a version with MIDI sounds (and only in the Chrome and Firefox browsers):

1. Retrieval of metadata and basic statical information

All metadata stored in the MusicXML file about the examined work (composer, work title, year of creation, etc.) can be displayed with the following command:

Now the simple statistical queries from the last tutorial: number of voices, number of notes (total and per voice), length in bars, ambitus, which we already learned about in the basics tutorial:

2. Frequencies: Pitches, pitch classes, tone durations

In order to characterize individual pieces of music and to compare different pieces of music, it can be useful to determine the frequency of certain elements (pitches, duration values, chords, etc.). With regard to such issues, frequency tables and graphical representations, so-called histograms, can be generated.

2.1 Pitch

Which tones appear how often? How diatonic is the tonal range of the Missa, how many additional chromatic notes appear?

What can we observe? The music is clearly diatonic whereas additional notes (F#, G# and Bb) are extremely rare.

The following command displays a list of pitch frequencies and exports it as a csv file (csv = comma separated variables; readable and processable in Excel or the text editor, among others). The export can be used to generate tables for comparison and corpus analysis. The csv file is saved in the folder that you have defined in your settings as "settings['directoryScratch']" and can be opened with a text editor or a spreadsheet program (e.g. Excel).

Let us compare the Josquin Kyrie with the b-minor ballad of Franz Liszt. What do you notice?

2.2 Pitch classes

The pitches can be combined into pitch classes in a second step. This makes the result clearer.

By the following commands the frequencies of the individual pitch classes can be displayed in a list and exported as csv file:

And again: comparison with Liszt’s ballad:

2.3 Tone duration values

What duration values does Josquin use in his Missa, and how often does each value occur?

The note values are counted as multiples of a quarter (Quarter Lenght). The note text thus consists mainly of half notes (2.0) and whole notes (4.0); other note values are less frequent.

2.4 Metric accents: tones on different metric positions

How clear is the meter in the individual voices of a composition. Basically, the degree of metrical clearness - through the placement of tones on measure beginnings and the metrically important positions within the measure (e.g. the middle of the measure or on the quarter positions)? For this purpose, a list of the frequencies of tones on the different metrical positions in the individual voices can be displayed.

The metrical accents follow the following weighting for the common time signatures (each for a sequence of eighth notes): in 4/4 time: 1.0, 0.125, 0.25, 0.125, 0.5, 0.125, 0.25, 0.125; in 3/4 time: 1.0, 0.25, 0.5, 0.25, 0.5, 0.25 etc..

This means: The beginning of the bar gets the highest weight with 1.0. 0.5 = middle weight, 0.25 lower weight and so on.

In the case of the "3/1 time signature", the 1.0 corresponds to the beginnings of the bar, the second and third whole positions in the bar, the 0.25 to the remaining half-positions.

3. Intervals in monophonic voices

Let us now go back to the Josquin example. How often do certain interval steps occur in the individual voices? Are all voices similar - or are there, for example, more leaps in the bass and more steps in the middle voices?

With music21, the answer to this question can only be found in several steps: First, a voice must be selected and designated with a new variable.

Superius = 0, Altus = 1, Tenor = 2, Bassus = 3 Let's choose the bass voice.

The following command let you count the interval steps in the bass voice ('bass'):

Now the comparison with the alto voice. What can be said from this about the nature of the progression of the two voices? Is it similar or different?

The following commands can be used to export the list of interval frequencies or to display it as a histogram.

4. Two-dimensional frequency distributions

We have already looked at the frequencies of pitches or pitch classes. Now we could say: Longer tones naturally have more weight than short tones or tones between beats. We can pursue this idea further by looking at combined, 'double' or 'bivariate' frequency distributions: So, for example, the frequencies of the pitches for each of the different duration values. This is what we will deal with in the following using two examples.

Example 1: Durations per pitch classes. Are there differences in the duration values with respect to the different pitch classes?

What can be gleaned from the graph?

There is another way of representing the relationship between pitches or pitch classes and sound durations: A 3-dimensional histogram:

Example 2: Tones on the differently accented metric positions (see above, 2.4) in relation to pitch classes. For this again a somewhat more complex command is necessary:

5. Tasks

Comparative statistical queries over multiple pieces:

So far, we have looked at the results using only one piece at a time. But how does the situation change if we compare several pieces, e.g. several movements by Josquin, with each other - and with the pieces of one of his contemporaries? Are there really stylistic regularities - or are differences predominant?

Select compositions of your choice (different genres, composers, and periods) and compare these pieces with respect to frequencies of pitches, pitch classes, note values, and intervals. Describe the results!