# 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.

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 \(\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:

Degree | n | Frequency (Hz) |
---|---|---|

Root | 0 | \(440\times 1 = 440\) |

Octave | 1 | \(440\times \left(1 + \frac{1}{1} \right) = 880\) |

5th | 2 | \(440\times \left(1 + \frac{1}{2} \right) = 660\) |

4th | 3 | \(440\times \left(1 + \frac{1}{3} \right) = 586\frac{2}{3}\) |

Major 3rd | 4 | \(440\times \left(1 + \frac{1}{4} \right) = 550\) |

Minor 3rd | 5 | \(440\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, \(\sqrt[12]{2}\), or, if you remember your root, fraction, and log identities, \(2^\frac{1}{12}\).

Again taking A440 as an example:

Degree | n | Frequency (Hz) |
---|---|---|

Root | 0 | 440 |

Half step | 1 | \(440 \times 2^\frac{1}{12} = 466.16\) |

Whole step | 2 | \(440 \times 2^\frac{2}{12} = 493.88\) |

Minor 3rd | 3 | \(440 \times 2^\frac{3}{12} = 523.25\) |

Major 3rd | 4 | \(440 \times 2^\frac{4}{12} = 554.37\) |

4th | 5 | \(440 \times 2^\frac{5}{12} = 587.33\) |

Tritone | 6 | \(440 \times 2^\frac{6}{12} = 622.25\) |

5th | 7 | \(440 \times 2^\frac{7}{12} = 659.26\) |

Minor 6th | 8 | \(440 \times 2^\frac{8}{12} = 698.46\) |

Major 6th | 9 | \(440 \times 2^\frac{9}{12} = 739.99\) |

Flat 7 | 10 | \(440 \times 2^\frac{10}{12} = 783.99\) |

7th | 11 | \(440 \times 2^\frac{11}{12} = 830.61\) |

Octave | 12 | \(440 \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.)

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.