In part 1, we derived the ratios of frequencies in a major scale. This gives us all the white notes on a piano but, as it turns out, they are tuned slightly differently than a piano is tuned. The scale we derived is a "pure" scale where the tuning of all the notes is perfect and the notes make perfect harmonies. Pianos aren't tuned to pure scales. Each note is slightly out of tune. To discover why, we have to answer another question - why does a piano have black notes?

There are 7 notes in the C major scale (C, D, E, F, G, A, B) then the scale repeats starting back at C. The ratios of those notes (as explained in the previous post) are shown in the table below. I've provided the fractions as well as the decimal values. Remember that we'll always divide or multiply by 2 until the answer lies in the range 1 .. 2.

Note | Fraction | Decimal |

C | 1 | 1 |

D | 9 / 8 | 1.125 |

E | 5 / 4 | 1.25 |

F | 4 / 3 | 1.3333 |

G | 3 / 2 | 1.5 |

A | 5 / 3 | 1.6666 |

B | 15 / 8 | 1.875 |

This works well for playing tunes in the key of C but sometimes you want to make the pitch higher or lower. Let's choose a higher pitch. The simplest fraction in the scale is for G (1.5 = 3/2). To create a scale in the key of G, we need to multiply all the frequencies by 1.5 like this:

Note | Calculation | Pitch |

G | 1 * 1.5 | 1.5 |

A | 1.125 * 1.5 | 1.6875 |

B | 1.25 * 1.5 | 1.875 |

C | 1.3333 * 1.5 / 2 | 1 |

D | 1.5 * 1.5 / 2 | 1.125 |

E | 1.6666 * 1.5 / 2 | 1.25 |

F# | 1.875 * 1.5 / 2 | 1.40625 |

Note that there are two pitches that don't match the C scale. Our value for A is 1.6875 in the G scale but it's 1.6666 in the C scale. It's close but still off. The value for F, however, is really off. In the C scale we have 1.3333 but in the G scale we're up to 1.40625. This is such a dramatic difference that you can definitely hear it and, in fact is close to halfway between the F and G in the C scale. We'll call this note F# since it's higher than an F but we'd like to use the letter F to have all the letters in our scale.

Now we do the same thing again. We pick the note halfway between G (1.5) and the next G (3.0) which is D (2.25) then divide by two to get it into the 1..2 range to give D (1.125). We multiply all the frequencies in the G scale by 1.5 (or 3/2) to create the D scale:

Note | Calculation | Pitch |

D | 1.5 * 1.5 / 2 | 1.125 |

E | 1.6875 * 1.5 / 2 | 1.2656 |

F# | 1.875 * 1.5 / 2 | 1.40625 |

G | 1 * 1.5 | 1.5 |

A | 1.125 * 1.5 | 1.6875 |

B | 1.25 * 1.5 / 2 | 1.875 |

C# | 1.40625 * 1.5 / 2 | 1.0547 |

Once again, our note for E is a little off from the C scale but the note for C is way off - it's about halfway between a C and a D. We'll call it C#.

The note halfway between D and high D is A so the next key to generate is A. I'll save you the calculations and just give the results for the remaining keys.

Notice that by the time we reach the scale of F#, we've introduced a new note called E# (1.3348) but this is so close to F (1.3333) that the notes would be virtually indistinguishable. If we did keep going more, we'd introduce new notes that are repeats of previous notes, so we'll stop at the scale of F#.

What notes do we have? Lets collect them up in order:

C

C#

D

D#

E

F

F#

G

G#

A

A#

B

Putting the sharp notes on black keys, you get 5 black keys and 7 white keys in every octave before it repeats.

We can run the same pattern in reverse. Starting at the scale of C (at the right side of the table below), we can divide each pitch by 1.5 (going right to left). Now, we create new notes that we'll call Flats. If you check the frequencies, though, the flats are almost the same frequencies as the corresponding sharps - Bb (1.7777) is the same as almost A# (1.7797), Eb (1.1852) is almost the same as D# (1.1865).

We're left with a problem. If we want to play in any scale with perfect tuning, we need an infinite number of keys. Fortunately, some of the pitches end up being close enough to other notes that we can use the other note instead.

So how do we come up with a compromise? That's the subject of part 3 in this series.