Now for the other half. For maximum starting flexibility without taking the cost too high, I opted to go two octaves, using notes found on the white piano keys only, i.e., notes with only letter designations and no sharp or flat symbols. This means I could play any song that fits within two octaves and is in the key of C, or can be transposed to the key of C, and has no "accidentals" (sharps/flats/naturals not defined by the key signature).
Human hearing is logarithmic, meaning what we perceive as a linear increase in pitch is really a geometric increase in frequency. So when we go "do re mi fa so la ti do", that second "do" sounds like the first, only one "level" higher ( kind of like climbing up seven stairs to the next floor). BUT in reality, the frequency has DOUBLED. Another "floor" up, and you're really FOUR TIMES as high. This allows for a sort of signal compression-- on the low end, we are very sensitive to changes in frequency, but on the high end, we sacrifice accuracy for dynamic range. Here's a graph.
Here's a blog that I grabbed the picture from. I haven't read it but it looks nice .
Following is what I learned about music.
Now the numbering on this graph is not very helpful. There's a better way. We currently use the" even-tempered scale" where there are 12 half-steps in each octave, which are evenly spaced in an exponential sense. There are other tunings, such as "just intonation" or the "well-tempered scale", but they're not used very much, despite having a few passionate boosters. We humans love to hear frequency ratios like 1:2, 1:3, 2:3, 4:5, or 4:5:6. The even-tempered scale is a compromise, approximating these sweet-sounding ratios while making instruments easy to tune and able to play in several keys. For example, instead of 5:4 ratio (1.2, a "perfect major fifth"), the even-tempered scale gives us the cube root of two, about 1.26.
The even-tempered scale is easy to model mathematically. An octave is a frequency doubling, and there are twelve steps in it. All we need now is some note to be defined in terms of a frequency. The people who decide such things picked "concert A" to be 440 Hz. (Hz is hertz, or cycles per second.) There is a passionate and genuinely crazy faction out there that insists that this definition is a Nazi plot to destroy the world, and that 432 Hertz is the "right" concert A. Personally, I think middle C should be defined as 256 Hz, which is 2^8, which would make repeated halving or doubling much easier.
Thus, to figure out the frequency of a note, I used
( f=440*2^(n/12) ), where f is frequency in Hz and n is the number of half steps from concert A. Concert A itself is n=0, notes lower than concert A are negative, and notes above it are positive, and it all works. For example, middle C is nine half-steps below concert A, so n=-9. This gives a frequency of
, which is about 261.63 Hz.
So... about all those letters. I'm not touching staff notation here, but each note has a name, which is a letter from A to G and then some modifiers. Each octave has eight letters in it. Now right away you know something's up, because if each letter represents a full step, and there are 12 half-steps in an octave, then there should be six letters in an octave. Well, I don't know all the reasons, but the interval between the letters is not always a full step. Cheating is involved. When you sing "Do Re Mi Fa So La Ti Do", you are singing C D E F G A B C (with the second C an octave higher). It seems like a straightforward linear progression, but in reality, there is only a half-step between E and F, and also between B and C. Where the half-steps are placed in a scale constitutes the "mode". The ancient Greeks used several modes in their music, but modern Western music settled almost exclusively on the "Ionian" mode. (More about modes here.)
This explains why there are "missing" black keys on a piano. Playing only the white keys gets you the "Do Re Mi" scale.
Letter notation also includes the half steps between letters (where they exist) by using sharps and flats. C sharp, written "C#" , is the half step above C, which is also a half step below D, which would be notated "Db". (The real "sharp" and "flat" symbols are smaller and stylized, but the hash and lowercase b are close enough here.)
So many notes have two names (separated by slashes below). All the notes in an octave are therefore:
C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B
and back to C again. I don't use B#(=C) or Cb(=B) or E#(=F) or Fb(=E), because it's confusing enough as it is, but yeah, some key signatures use them.
But this doesn't say which specific note, because which octave are we in? Scientific pitch notation uses a number after the note name to designate the octave. Concert A is notated A4. (Again, if I were getting fancier about the formatting, the 4 would be a subscript.) Middle C is C4. The lowest note on a piano is A0, and the highest is A8. E0 is the low end of human hearing, and Eb10 is the high end.
So armed with this, I determined to start with 16 notes, using just the "white keys".
UPDATE: Apparently a few people thought of the middle C= 256 Hz thing centuries before I was born, which is cool. The article also provides some justification for the concert A=432 Hz, but when you get right down too it, the second is an arbitrary measure, so why fight so hard for integer frequency numbers? The C=256 thing seems like it would be helpful for computer programming.