# Why are there only 12 pitch notes (C, C#, …, B) in the world?

This was originally a response to a quora question that I went down a long rabbit hole answering.

First of all – let’s cover some basic stuff.  What is frequency?
Here is the sound wave of a recording of me playing the low E string on my guitar. There are multiple oscillations happening here and you can what’s called a Fourier transform to figure out how much of each frequency there is. You can see that there are multiple frequencies in this sound, but the strongest frequency is at around 82 Hertz or 82 oscillations per second.  We perceive this sound as a low E note.

If I play the next higher E note on my guitar the dominant frequency is twice as high (164 Hz).  If I play the next higher E the dominant frequency doubles again.

Here the x axis is the perceived pitch or note and the y-axis is the frequencies.  Each A note is an octave apart but the frequency is doubling each time. The perceived pitch difference between two frequencies goes down as the frequencies go up.  Another way of saying this is the frequency difference between two notes gets further apart as the notes get higher.

Here’s a little illustration of that with the real frequencies of notes. A scale is generally divided into even pitch increments (this is called “equal temperament”).  This means that the ratio of the frequency of a note and the frequency of the next note is always the same.

So why 12 intervals?

There’s a second fact about the way we perceive sound which is that two sounds with a simple frequency ratio sound good.  There is a lot of fascinating research about when and why this is true – I really enjoyed Music, A Mathematical Offering by Dave Benson that goes really deep into how our ear works and why we perceive sound the way we do.  But let’s take this as given.

For example two notes an octave apart have a frequency ratio of 2:1 and they sound very resonant.

Besides an octave, the simplest possible ratio is 3:2 – halfway to the next octave.  It’s the basis of all the most common chords and it’s really nice to have this ratio in a scale.  But if we want to evenly space the pitch of our notes, we will never get exactly this nice ratio.

For example if we have 6 notes we don’t even get close. Starting at note “0”, we have no note in our scale that is anywhere near halfway to the next octave.

But if we use twelve notes we happen to get really close. Note number 7 happens to be almost exactly halfway between our root note zero and the next octave higher.

This turns out to really just be a happy coincidence.  For fun I graphed all the possible scales between one and 24 notes. It turns out 12 notes happens to have a note that is way closer to the halfway point than any other number of notes.  When we get to 24 notes the same note shows up.

Another way of looking at this is just plotting how close each scale gets to the halfway note.  This “halfway note” is extremely confusingly often called a “fifth” in music. Here lower is closer, and you can see that 12 is by far the number of notes that works best.

Since we’ve come this far we might as well see what happens if we try larger scales. At 29 notes we get a slightly better halfway note.  At 41 notes we get one even better.  But for small numbers of notes 12 stands out as a much better choice than any other.

This is a little off topic now, but I was interested to see how well the other notes in the 12 note scale line up with simple intervals. The halfway interval or “perfect fifth” lines up the closest with the exact mathematical interval, but there are also notes that correspond closely to almost all of the other simple intervals.  It’s interesting that no note seems to correspond with going 3/4 of the way to the next octave.

I hope you had as much fun reading this as I did exploring this and making graphs :).