Aesthetics, math, and music

I’ve been talking a lot lately with a couple friends about what imbues music with emotion, why certain chords and intervals are more pleasant sounding than others, whether expectations about resolutions are learned or somehow innate (e.g. I–IV–V7 seems to naturally want to only go to one place: I), and other similar questions. I’ve been saying that a lot of it has to do with the mathematics of music, so the relationship between aesthetics and mathematics was already on my mind when the post about the golden ratio and Apple’s iCloud icon made its way around Twitter the other day, and only made me more excited about that relationship.

icloud golden ratio

So with that motivation, here is a brief primer on the mathematics of music, particularly as it relates to intervals and tuning. It is adapted partially from a 2004 post I made to the AppleNova forum, and partially from some demos I put together (unassigned, of course) for a Physics of Music class I took in fall 2005.

Any interval between notes can be (in theory) defined is a ratio between frequencies, and intervals that have traditionally been considered consonant are part of the natural harmonic series, and therefore have low-integer ratios.

The harmonic series turns up in a couple places in music/audio. In audio, harmonics occur in all natural (i.e. non-synthesized) sounds. It’s the relative weighting of each of the harmonics that give each sound its unique timbre. I’m not really going to be talking about the harmonic/spectral breakdown of individual notes in this post, though. I’m just focusing on the relationship between notes and other notes — what I’m calling the harmonic series in music as opposed to in audio.

The harmonic series is defined as 11,12,13,,1n\frac{1}{1}, \frac{1}{2}, \frac{1}{3}, \dots, \frac{1}{n}. (Mathematicians, ever wonder why the harmonic series was called that? This is why.)

This makes the theoretical definition of the larger intervals easy. Taking A440 as an example:

DegreenFrequency (Hz)
Root0440×1=440440\times 1 = 440
Octave1440×(1+11)=880440\times \left(1 + \frac{1}{1} \right) = 880
5th2440×(1+12)=660440\times \left(1 + \frac{1}{2} \right) = 660
4th3440×(1+13)=58623440\times \left(1 + \frac{1}{3} \right) = 586\frac{2}{3}
Major 3rd4440×(1+14)=550440\times \left(1 + \frac{1}{4} \right) = 550
Minor 3rd5440×(1+15)=528440\times \left(1 + \frac{1}{5} \right) = 528

That’s where it stops working, though. Closer intervals don’t neatly obey the harmonic series. But you know something else about intervals that are not in the harmonic series? They’re perceived as dissonant. Interesting, eh?

Now, the reason I said that these are the frequencies of the notes in theory is because that’s not how western music is actually tuned. The system outlined above is called just intonation; however, this system has several drawbacks, including the inability to be played equally in tune in any key, and intervals other than those listed above being constructed from large integer frequency ratios from much higher in the harmonic series.

Beginning in the late 16th century, a competing intonation system (that was much more difficult to obtain mathematically back in the day), equal temperament, began to gain favor in Europe. (In fact, J.S. Bach’s Well-Tempered Clavier was written in order to demonstrate equal temperament’s ability to be played in tune in all twelve major and minor keys.)

Equal temperament is based on the twelfth root of 2, 212\sqrt[12]{2}, or, if you remember your root, fraction, and log identities, 21122^\frac{1}{12}.

Again taking A440 as an example:

DegreenFrequency (Hz)
Root0440
Half step1440×2112=466.16440 \times 2^\frac{1}{12} = 466.16
Whole step2440×2212=493.88440 \times 2^\frac{2}{12} = 493.88
Minor 3rd3440×2312=523.25440 \times 2^\frac{3}{12} = 523.25
Major 3rd4440×2412=554.37440 \times 2^\frac{4}{12} = 554.37
4th5440×2512=587.33440 \times 2^\frac{5}{12} = 587.33
Tritone6440×2612=622.25440 \times 2^\frac{6}{12} = 622.25
5th7440×2712=659.26440 \times 2^\frac{7}{12} = 659.26
Minor 6th8440×2812=698.46440 \times 2^\frac{8}{12} = 698.46
Major 6th9440×2912=739.99440 \times 2^\frac{9}{12} = 739.99
Flat 710440×21012=783.99440 \times 2^\frac{10}{12} = 783.99
7th11440×21112=830.61440 \times 2^\frac{11}{12} = 830.61
Octave12440×21212=880440 \times 2^\frac{12}{12} = 880

How different do these look and sound? These are two A major chords (of sine waves), one in just intonation, the other in equal temperament. (Excuse the JPEG compression artifacts. I made these in 2005 before PNG really caught on, and I don’t have access to MATLAB anymore.)

A Major - Just Intonation

A Major - Equal Temperament

What you’ll notice is that the chord in equal temperament has imperfections and asymmetries that the just intonation one doesn’t. While this doesn’t have much impact because these are sine waves, you can imagine that when played on real instruments, the interactions between the upper harmonics would be much more complex in equal temperament.

When you listen to them, listen for the “beats” in equal and notice how the are absent in just intonation, resulting in a more pure sound.

And for your listening pleasure, a C major scale with each note played in Pythagorean, just, and equal tunings.

Here’s a zip file of all the sounds, graphs, and the MATLAB code to generate it. I haven’t looked at it in six years, but I assume it does something useful.