The ancient Greeks, who had only simple stringed instruments and flutes, noticed two things about pitches produced by a vibrating string. They noticed that a string of half the length of another but with the same tension and thickness sounded similar. For example if the original string played a frequency of 880 Hz the string of half the length would play a note of 440 Hz, an octave lower. The same thing happens by holding the string down in the center; each half will sound a note and octave higher than the full length. They also noticed that holding a string down at 2/3 of its length would produce two notes (by plucking each side) that sounded pleasant together. We call the interval between these two notes a perfect fifth (if you sing the children’s song Baa Baa Black Sheep the first Baa and Black are a fifth apart). Two other notes that sound good together are the notes produced by the long part of the 2/3 of the string and the note formed from holding the string down at its center. The interval between these two notes is called a perfect fourth and the ratio between them is 4/3 (the first two notes of Hark the Herald Angels Sing).
As we have learned, the frequency of the fundamental is the main factor that determines the pitch of the note we hear but not the only one. In the following you will notice that the frequencies are often not exactly harmonics nor whole numbers. In most cases this does not matter because our hearing is not accurate enough to detect the difference of a few Hz (remember that the JND in frequency is about 1 Hz for tones below 1000 Hz). The modern, equal temperament scale divides an octave into twelve equal steps (called semitones). Each semitone is divided into 100 cents. On the equal-tempered scale (see below) this is about 0.3 Hz. Trained musicians can hear a difference in frequencies of five cents (1.5 Hz) under test conditions. Normal music notes may be off from their intended frequency by as much as 20 cents (about 6 Hz) but we don’t notice unless the sounds are isolated.
Is there a reason that notes with a ratio of 2/3 (a perfect fifth) and other ratios sound good together? Maybe. In the case of fifths the harmonics overlap (a note whose fundamental is 300 Hz has harmonics at 600 Hz and 1200 Hz which overlap with the harmonics of a fundamental at 200 Hz which are 400 Hz, 600 Hz, 800 Hz, 1000 Hz and 1200 Hz). In other words, there is less dissonance (roughness produced by overtones which are close to but not exactly the same frequency). It is not clear why humans tend to find notes with overlapping harmonics pleasing but this seems to be true in most cultures (although the notes and scales used may be different). The western world inherited Greek preferences for scales but many non-western cultures include other preferences which sound odd to the western ear. An appreciation for these sounds can be learned, however.
The realization that the ratios 2/3 and 1/2 (octaves) sound good together lead the Greek philosopher and mathematician Pythagoras to come up with what is now known as the Pythagorean scale. To construct this scale we start with a note or frequency. If we double it we have the same note an octave higher. If we multiply or divide by 3/2 we have notes in between. In the example below we start with the note D at 147 Hz and apply the rule (the frequencies are rounded off to whole numbers in this example). The first five notes generated by this procedure are called the pentatonic scale which has been used for two thousand years. If we generate two more notes we have a septatonic scale or seven notes between the two notes an octave apart. The procedure can be continued to find other notes in this octave.
It should be noted that Pythagoras only codified this scale mathematically; musicians were already using it because it sounded good. It seemed to be interesting and important to Pythagoras and other early mathematicians that what sounded good to the ear could be explained as simple mathematical ratios between the lengths of the string on a harp.
A particular choice of starting note and system of generating a note scale is called a mode. If we start with the note F and multiply/divide by 3/2 and 2 each time we generate a scale called the Lydian mode. If we start with B and apply the rule the seven note scale is the Locrian mode.
A later mathematician and astronomer, Ptolemy, added notes to the Pythagorean scale by including ratios of 5/4. Using the same procedure as above (multiplying or dividing by 5/4 and 2) will also produce a seven note scale but with slightly different frequencies. So for example 261.63 Hz × 5/4 = 327.04 Hz which would be the note B but it doesn’t quite have the same frequency as the B in the Pythagorean scale (331.12 Hz). However most people cannot hear this small of a frequency difference unless a direct comparison is being made with another tone (in which case you can hear beats) so a song played or sung with this set of frequencies sounds about the same as the Pythagorean scale. For the Pythagorean scale, it doesn’t matter which note you start on, each scale sounds similar because the spacing is similar because the ratio is always 2/3. This turns out not to be true for the scale created by Ptolemy because some ratios are 4/5 and others are 2/3. So shifting keys or modes (starting at a different note) does make a difference in the Ptolemaic system but not in the Pythagorean.
In the 14th century music began to get more complicated. Instead of everyone singing the same note in a choir, harmony became popular. Prior to this time most music in Europe was church music and was governed by strict rules (they were supposed to always use the Pythagorean scale). As folk music became more popular some of these rules were relaxed. Rounds (like Row, Row your boat), where each singer sings the same song but starts a bar later, also became popular. In order for this to sound good most of the notes of the song should harmonize with each other (so that when they overlap there is harmony; in other words many of the harmonics overlap). What performers discovered was that the notes in the Ptolemy scale allowed more harmonizing because there is more of a variety of notes. Eventually this scale replaced the more rigid Pythagorean scale. We now call the Ptolemaic scale the Just scale.