Mean Beethoven

Year: 2022 Authors: Dirk Schlingmann

Core claim

Algorithmic averaging of MIDI note data can generate a recognizable “mean” Beethoven sonata, and mode-based variants sound more appealing to the author.

Topics

algorithmic music, statistical mean, Beethoven piano sonatas, MIDI data

Domains

statistics, averaging, mode, music composition, computer music, sound synthesis

Methods

MIDI encoding, spreadsheet-style note alignment, mean calculation, mode-based aggregation

Media

MIDI files, computer program, Beethoven piano sonatas

Paper text

The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.

Dirk Schlingmann

Abstract

Can we extend the concept of the statistical mean to music? Can we find the mean of all 32 Beethoven piano sonatas? In this paper, I will investigate and provide possible answers to these questions.

Introduction

Computers, the Internet, and technology have advanced the way we learn and create. Playing sounds, displaying graphics, viewing moving images, and programming solutions have enhanced conceptual understanding and creative endeavors. With computing power, we can tackle real data and real problems. In this paper, I try to show how algorithmic music programming can provide musical solutions that are based on mathematical concepts and that expand our ideas of music.

Algorithmic Music

Music is an artistic composition of sounds. We often use instruments to create musical sounds, which are represented by notes in a musical score. If we want different instruments to collaborate on a piece of music, the instruments need to be designed in such a way that they produce sounds that are pleasing together. During the evolution of music, humans have recognized that certain ratios of frequencies of tones (pitches) produce favorable consonant sounds (chords). If the pitches (frequencies) adhere to a rigid common musical tone or tuning system, a whole orchestra with many different instruments and many different notes interacting with each other can play beautiful music together. Such a system is the 12-tone equal temperament, which is widely used in the Western world of today. With the introduction of computers and synthesizers, a Musical Instrument Digital Interface (MIDI) was engineered for this 12-tone equal temperament. MIDI has enhanced music and facilitated communication between MIDI devices. For a more detailed introduction to MIDI, please consult the information at reference [2].

In terms of mathematics, a music score is a list of notes, which are the instructions on how to perform the musical piece. A note is determined by its time-measure (the time when the note is turned on and the time when it is turned off), its pitch (frequency), the instrument (timbre), and the volume (dynamics or loudness). Each music note in a song can be described using the following notation or data structure: note = {{time-on, time-off}, pitch, instrument, volume}. A song is the set {note[1], note[2], …, note[n]} of finitely many notes where note[i] = {{time-on[i], time-off[i]}, pitch[i], instrument[i], volume[i]}. This set of notes is stored in a MIDI file.

song = { {time-on[1], time-off[1]}, pitch[1], instrument[1], volume[1]}, … , { {time-on[n], time-off[n]}, pitch[n], instrument[n], volume[n]} } .

In mathematics, we prefer numbers instead of music notation. For example, a standard grand piano has 88 keys (A0 through C8 in music notation) with corresponding MIDI numbers 21 through 108. Please note that the piano has the MIDI number 1, and the volume is a number between 0.0 and 1.0, where 0.0 is silence and 1.0 is maximum volume. For a more detailed list of MIDI instruments and their MIDI numbers,

Schlingmann

please consult reference [3]. Using MIDI numbers, here are the first two and last two notes of the 1637 notes of Beethoven’s Adagio from his famous Pathetique sonata.

adagio =

If we look more closely at the above MIDI data, we realize that a computer and a computer program might be helpful or even much more efficient in creating a set of individual notes and its associated music. The parameters for pitch, time-on, time-off, instrument, and volume can originate from mathematical objects, abstract concepts, or any appropriate data coming from almost anything imaginable. A computer algorithm (a carefully written computer program) can produce music that goes beyond traditional music. Music created by such computer algorithms is called algorithmic music. Algorithmic music is not limited to the MIDI environment. We can program our own unique sounds of any frequency and any timbre. Algorithmic music opens a door into a new world of music (references [4] and [5]).

Mean Beethoven

Mathematics, computing, and algorithmic music can also assist us in answering questions like “What would a mean Beethoven piano sonata sound like?” In terms of mathematics, the mean calculates the average. It might be easy to calculate the average number of a finite list of real numbers. We add up the individual real numbers and then divide the sum by the length of the list. The mean of the n real numbers x1, x2, …, xn is . Creating a mean Beethoven piano sonata is not that simple. Here are my attempts.

Beethoven wrote 32 piano sonatas. A complete list of MIDI files for all 32 piano sonatas can be found at Kunst der Fuge (reference [1]). Let us assume that all sonatas start at time 0.0. First, we organize the data of all individual notes from all piano sonatas. Let us assume that the notes of each individual piano sonata have already been put into a rigid order following these two rules. Notes with an earlier time-on are listed before notes with a later time-on. If notes share the same time-on value, then notes with a lower pitch are listed before notes with a higher pitch. Next, we create a spreadsheet-like layout of rows and columns where each row represents all the ordered MIDI notes of a piano sonata. If we introduce the notation, to determine the j-th note of piano sonata i, then the described spreadsheet would look like the highlighted area of Table 1.

Before we calculate the j-th note (note_meanB[j]) of Mean Beethoven, we need to be aware that different piano sonatas have different amounts of notes. For example, piano sonata 1 has 7331 notes. Piano sonata 2 has 9340 notes, and so on. Piano sonata 20 has 2937 notes, which is the least amount of notes of all 32 piano sonatas. Piano sonata 19 contains 3362 notes, which is the second smallest amount. Piano sonata 23 contains 15575 notes, which is the second highest amount; and piano sonata 29 has 21579 notes, which is the highest amount of all 32 piano sonatas. When we compute note_meanB[j], we must avoid adding data items that do not exist.

Now, let us produce a version of Mean Beethoven. The j-th note of Mean Beethoven can be calculated using the usual data structure

note_meanB[j] = {t-on_meanB[j], t-off_meanB[j]}, p_mean[j], instr_meanB[j], v_meanB[j]}.

If , then

t-on_meanB[j] = (t-on[1, j] + … + t-on[32, j])/32, t-off_meanB[j] = (t-off[1, j] + … + t-off[32, j])/32,

p_meanB[j] = Round[(p[1, j] + … + p[32, j])/32], instr_meanB[j] = 1, and

v_meanB[j] = (v[1, j] + … + v[32, j])/32.

Mean Beethoven

If 2937 < j <= 3362 , then

t-on_meanB[j] = (t-on[1, j] + … + t-on[19, j] + t-on[21, j] + … + t-on[32, j])/31,

t-off_meanB[j] = (t-off[1, j] + … + t-off[19, j] + t-off[21, j] + … + t-off[32, j])/31,

p_meanB[j] = Round[(p[1, j] + … + p[19, j] + p[21, j] + … + p[32, j])/31],

instr_meanB[j] = 1, and

v_meanB[j] = (v[1, j] + … + v[19, j] + v[21, j] + … + v[32, j])/31.

If j > 3362 notes, then we continue in the above fashion. The bottom row of Table 1 shows note_meanB[1] and note_meanB[2].

Table 1: Organization of the Notes of Beethoven’s 32 Piano Sonatas with Mean

1stnote2ndnote
sonata 1{0.0, 0.165593}, 60, 1, 0.266667}{0.256417, 0.420606, 65, 1, 0.282353}
sonata 2{0.0, 0.110294}, 57, 1, 0.470588}{0.0, 0.110294}, 69, 1, 0.470588}
sonata i{t-on[i, 1], t-off[i, 1], p[i, 1], 1, v[i, 1]}{t-on[i, 2], t-off[i, 2], p[i, 2], 1, v[i, 2]}
sonata 32{0.0, 0.184606}, 51, 1, 0.737255}{0.0, 0.184606}, 63, 1, 0.737255}
mean{0.0, 0.686135}, 55, 1, 0.426471}{0.0806185, 0.854284}, 55, 1, 0.411275}

We will end up with the following excerpt (first two notes and last two notes) of Mean Beethoven, where the last note is note_meanB[21579].

Mean Beethoven =

{ {0.0, 0.686135}, 55, 1, 0.426471}, { {0.0806185, 0.854284}, 55, 1, 0.411275}, ..., { {2302.65, 2311.33}, 77, 1, 0.92549}, { {2302.65, 2311.33}, 82, 1, 0.941176} }.

When we listen to Mean Beethoven (supplemental MIDI-file MeanBeethoven.mid), it does not sound grandiose. It did not turn out—what some of you intuitively were hoping for—to be another beautiful piano sonata similar to the 32 existing piano sonatas. However, in a mathematical sense, we should have expected a monotonous song, at least at the beginning of the song. Because the mean calculates the center of a data set, the mean pitches hover around the center. Of course, at the end of Mean Beethoven, from the note through the note, Mean Beethoven sounds like the end of piano sonata 29.

Mode Beethoven

In mathematics, the modes of a list of numbers are the numbers that occur most frequently in the list and that occur at least twice. If each number in the list of numbers occurs only once, then the mode does not exist. The mode can also be used as a measurement of the central tendencies of a set of numbers. In this paper, let us slightly modify the correct mathematical definition of the mode to also allow the mode to be each number in a list of numbers if each number occurs only once. What happens if we use this modified definition of the mode instead of the mean in the creation of a central Beethoven sonata, which we call Mode Beethoven? If there is more than one mode, then we take the average of the modes. We create Mode Beethoven by replacing note_meanB[j] with

note_modeB[j] = {{t-on_modeB[j], t-off_modeB[j]}, p_mode[j], instr_modeB[j], v_modeB[j]},

Schlingmann

where

t-on_modeB[j] = Mean[{Mode[{t-on[1, j], …, t-on[32, j]}}],

duration_modeB[j] = Mean[{Mode[{t-off[1, j] - t-on[1, j], …, t-off[32, j] - t-on[32, j]}}]

t-off_modeB[j] = t-on_modeB[j] + duration-modeB[j],

p_modeB[j] = Round[Mean[{Mode[{(p[1, j], …, p[32, j]}}]],

instr_modeB[j] = 1, and

v_modeB[j] = Mean[{Mode[{v[1, j], …, v[32, j]}}]}

if 1 j 2937, for example.

When I listen to Mode Beethoven (supplemental MIDI-file ModeBeethoven.mid), it already sounds more appealing to me in comparison to Mean Beethoven. Using the modified mode adds more diversity.

We even add more diversity if in the formulas for note_modeB[j], we randomly pick (abbreviated by RP) a mode if there is more than one mode instead of calculating the mean of the modes. We create Random Mode Beethoven by replacing note_modeB[j] with

note_rmodeB[j] = {{t-on_rmodeB[j], t-off_rmodeB[j]}, p_rmode[j], instr_rmodeB[j], v_rmodeB[j]},

where

t-on_rmodeB[j] = RP[{Mode[{t-on[1, j], …, t-on[32, j]}}],

duration_rmodeB[j] = RP[{Mode[{t-off[1, j] - t-on[1, j], …, t-off[32, j] - t-on[32, j]}}]

t-off_rmodeB[j] = t-on_rmodeB[j] + duration_rmodeB[j],

p_rmodeB[j] = RP[{Mode[{(p[1, j], …, p[32, j]}}],

instr_rmodeB[j] = 1, and

v_rmodeB[j] = RP[{Mode[{v[1, j], …, v[32, j]}}]}

if 1 j 2937, for example.

When I listen to Random Mode Beethoven (supplemental MIDI-file RandomModeBeethoven.mid), it sounds even more appealing to me than Mode Beethoven.

If we transpose all sonatas into the same key, we might further enhance the appeal. You be the judge. For Random Mode Key C Beethoven (supplemental MIDI-file RandomModeKeyCBeethoven.mid), I have transposed all sonatas into the key of C major (A minor).

Summary and Conclusions

The algorithmic music Mean Beethoven, Mode Beethoven, Random Mode Beethoven, and Random Mode Key C Beethoven are my first attempts at finding an average Beethoven sonata. For me, the songs increase in attractiveness when I switch from Mean to Mode to Random Mode to Random Mode Key C. I believe this music has its place in the world of applications of mathematical ideas.

References

[1] Kunst der Fuge. https://www.kunstderfuge.com/.

[2] MIDI Association. https://www.midi.org/.

[3] MIDI Association. General MIDI 1 Sound Set. https://www.midi.org/specifications-old/item/gm-level-1-sound-set.

[4] D. Schlingmann. Algorithmic music albums. https://open.spotify.com/search/Dirk%20Schlingmann/albums.

[5] D. Schlingmann. Music via Math. https://www.amazon.com/Music-via-Math-Dirk-Schlingmann-ebook/dp/B07VTR4DKX/.

0 items under this folder.