Unlike a violin player, who has the freedom to play an almost infinite variety of different notes by virtue of the fact that he has extremely fine control over the pitch of the vibrating string and thus use his ears to select the most appropriate one to blend in with the other instruments, keyboard players have no such facility. The pitch of their instrument is fixed - the string player can play hundreds of different intervals within the span of a single octave, the poor piano player only has twelve and these must serve him in all weathers. This is where temperament comes in; tempering seeks to make small adjustments in the tuning of intervals, such as Major 3rds and 7ths, so that when these intervals are played in different keys, they sound to our ears pretty much the same or, to put it another way, so that they retain the same level of concordancy (or even discordancy!). Why bother to do this? Well if we tuned a piano to pure intervals, we'd soon find out that while a C Major 7 chord sounds fine, playing an F# Major 7 would set our teeth on edge - in fact, in a pure temperament tuned on C, a C Major 7 chord would sound much "sweeter" than it would on a modern equally tempered keyboard.
The most important thing to bear in mind is that we judge whether an interval is consonant or dissonant solely by its effect on the ear; that and a hell of a lot of neural processing. Consider this: if you give someone two tone generators and ask him or her to adjust the relative pitch of one of them to a number of different intervals, such as a fifth, Major 3rd etc., and then you measured the interval ratios (i.e. the ratio of their respective vibration rates) of these intervals, you'd probably find that their ears had led them to produce intervals in simple whole number ratios; 2:1 - an octave, 3:2 - a fifth, 5:4 - a Major 3rd and so on. I should perhaps point something out here: although, in a broad sense, pure intervals are formed of simple whole-number ratios, there is no natural or physical law that suggests that consonant intervals cannot be formed from other, more complex ratios. In other words, there's no real reason for a scale to have only twelve notes in its span or even for the octaves to be in tune in order for it to produce consonant intervals.
Our ears are exquisitely sensitive devices - a pin dropped at our feet in a quiet room produces about one quadrillionth (10-16) of a watt of acoustic energy which moves the eardrum less than the diameter of a hydrogen molecule. An orchestra going full bore pumps out about 70 watts of which 40 watts is generated by the bass drum alone! In terms of amplitude, the ear has a useful sensitivity range of 20,000,000 to 1 - our sense of pitch discrimination is almost as good. One can even go so far as to say that our intervallic sense is a direct result of the very physiology of the ear and its associated processing devices. 
In the history of music, it has been noted that technological advance has usually preceded developments and innovations in artistic style and musical direction - the invention of the double escapement mechanism in piano action, which allows the hammer to fall back off the strings even with the key still pressed home, permitted Listz his fiery virtuosity and allowed Chopin to write some of the most extraordinary music for the instrument. Arguably the most influential technical advance has been temperament. The earliest music we know of was homophonic, that is, consisting of single melody lines; the earliest temperament was probably Pythagorean (see below) which only really allows four truly concordant intervals thus restricting the form of the music (you could of course use discordant intervals for variety - little if any authenticated material exists from those times so who knows?).
The comparative lack of concordant interval leaps also limits modulation and duophony; no one in ancient Greece would have dreamed of either moving to the Major 3rd or placing it in parallel with the tonic as it was dissonant, but today we consider the Major 3rd consonant - weird! Let's take a quick look at some numbers and try and get a handle on all this - don't worry, you won't need a calculator just yet! We've seen how the interval between any two notes can be described in terms of their frequency ratios; for example, the octave has a ratio of 2:1 - that is to say, the frequency of one component is twice that of the other. This allows us to compare the magnitude of the intervals under scrutiny without reference to their frequencies. We can express other pure intervals in similar fashion: the fifth has a ratio of 3:2, the major third 5:4, the minor seventh 16:9 and so on. By adding ratios together (actually, being fractions we have to multiply them) we can form new intervals. Add a perfect fourth to a perfect fifth and we get an octave (4/3 x 3/2 = 12/6 or 2/1). If, when adding two ratios together, we exceed by an octave or more, multiply by 1/2 for each octave raised to get the interval back within the confines of an octave (two perfect fifths: 3/2 x 3/2 = 9/4 x 1/2 = 9/8 or Major Second).
If we examine the interval ratios of all the diatonic intervals in the puretone temperament, two curious facts emerge:
First, intervals which we consider concordant (pleasant-sounding) have simpler ratios than discordant (harsh-sounding) ones; generally, the higher the number, the more discordant the interval and second, all these ratios are numbers which are multiples of the prime numbers two, three and five: you may also notice that these ratios are identical to certain members of the harmonic series. Right, we've got nice simple numbers describing these intervals so what's the problem? The problem is that the interval ratios between successive degrees of the scale are not equal. This means that if you play an interval in one key, it'll sound different in another. Take a fifth, for example. Play the interval C-G in this puretone temperament and it'll sound perfectly OK but play F#-C# and the interval ratio, instead of being 3:2 is now 1024:675 or almost a fifth of a semitone too sharp (divide 45:32, the augmented fourth from C, by 32:15, the Minor Second raised one octave). Now since the ear can just about hear a difference of one hundredth of a semitone, playing this interval is going to sound distinctly odd.
So, although the puretone temperament has the benefit of greater
overall concordancy, because its primary interval ratios (3:2, 4:3 etc.)
lie alongside those some of the harmonic series, it will only work in one
key. This limits the possibilities of harmony, an essential component of
Western music of the last 400 years, thus many attempts were made by various
people over the years to "re-tune" or temper the interval ratios such that
as many keys as possible sounded approximately the same.
If these are remapped into the key of C we get:
We owe the basis for our present musical system to the ancient Greeks. Some 2500 years ago, Pythagoras (he of the right-angled triangles!) realised that simple intervals could be formed by dividing a stretched string such that the divisions were in whole-number ratios; divide it in half and you get an octave; divide by a ratio of 3:2 and you get a fifth and so on. He asked a very important question, "Why is consonance determined by the ratio of small whole numbers?", meaning that as the ratio numbers get larger, the interval gets more dissonant. Now at that time, the Greeks were into the natural sciences; they were probably amongst the first people to study natural phenomena and to seek an explanation of the way the universe worked through empirical observations and deductions, but they were also noted for their aesthetic appreciation of the arts. In particular, the epic poems of Aristophanes, Homer and others were probably performed by "speaking on key" rather than mere reading. Often, this would be accompanied by musical interjections and underscoring on instruments such as the lyre or aulos. A common instrument from those times was the tetrachord, a kind of four-stringed harp. These essentially open-tuned instruments spanned a fourth on the outer pair of strings with the inner pair tuned to intervals ranging from quarter tones to two tones. Pythagoras spent much time experimenting with different ways of tuning these instruments in an attempt to formalise the procedure. One of his major contributions to music was extending the range of the scale by using two tetrachords tuned a fifth apart. This then gave a range of an octave and, consequently, a much wider variation of scales became possible which were to become known as Modes. Here they are mapped to our present system:
Since these scales now spanned an octave, some method was needed to tune them in a consistent fashion. As I said before, Pythagoras noted that dividing a string into half and then half again produced a succession of higher and higher octaves; not really much use as the basis for a musical scale. His temperament is based, therefore, on a continuous projection of the pure fifth which, as you recall, is a ratio of 3:2. Starting with the pure fifth C-G, add the pure fifth above, D; drop this an octave.
Now our scale has C, D and G in it - OK, go back to the high D and go up another pure fifth to A; drop this an octave, go up another pure fifth, drop that appropriately and continue in like fashion until you arrive at C again (this is after 12 iterations encompassing a span of seven octaves). You should now have a chromatic scale of twelve notes with successive intervals limited to tones or half-tones and everything all bundled up nicely - or do we?
It is perhaps unfortunate for us that Pythagoras didn't proceed to divide the string into fifths, sevenths and so on otherwise music might have taken a very different course. The problem stems from Pythagoras's use of the pure fifth as the sole basis for calculating the scale. To demon- strate this, we're going to have to take a look at a device called a cent (groan! Not more maths?). Put simply, a cent is one hundredth part of an equal semitone; with twelve semitones in an octave, this gives us 1200 cents in an octave. The cent is more useful than ratios because ratios only show the order of magnitude of the interval, not the relative size.
Here we go, in at the deep end: Cents may be calculated from ratios in the following fashion:
LOG i x (K/LOG 2) = Pitch Interval
where i is the interval ratio expressed as a decimal and K is an integer such that we have a convenient unit size for the octave. Let's look at Pythagoras's fifth:
3 ö 2 = 1.5
LOG 1.5 = 0.176091259056
K = 1200 
1200 ö LOG 2 (0.301029995664) = 3986.31371386
3986.31371386 x 0.176091259056 = 701.955000865 cents
Now an octave, we know, is 1200 cents; therefore seven octaves is 8400 cents but twelve pure fifths is a whisker less than 8424 cents. Ouch! Something has gone awry. What we end up with is a scale where the fourths and fifths are perfectly tuned but the rest are not. In particular, the Major 3rd is too sharp, in fact so sharp that Pythagoras (and everyone else!) regarded it as a dissonance. These tiny errors are known as commas; the overall error is called a Pythagorean comma and the error in the third is called a Syntonic comma or the Comma of Didymus. Because the sole "yardstick" for the scale's creation is the ratio 3:2, all the interval ratios of the Pythagorean scale are, perforce, multiples of the prime numbers 2 and 3. This has the effect of limiting the variety of possible ratios and therefore, the actual pitches of the scale.
Back to the Greeks: Pythagoras's rather arrogant assertion that 'intervals
in music are rather to be judged intellectually through numbers than sensibly
through the ear' was challenged by a guy called Aristoxenus, a student
of Aristotle. He considered that aesthetic appreciation was more important
than the maths. As the basis for his scale, he took two tetrachords with
the top note of the upper tetrachord tuned a perfect fifth above the top
note of the lower one. Since each tetrachord spans a fourth, the disjunctive
tone (the interval between the top note of the lower tetrachord and the
bottom note of the upper one) is the difference between a perfect fifth
(702 cents) and a perfect fourth (498 cents) or 204 cents. If our notes
of the lower tetrachord are C D E F, D is a Pythagorean tone (204 cents)
from C, F the perfect fourth and E the interval we now know as the Major
third (386 cents). If we add the same group of four notes starting from
G we arrive at the following intervals in cents:
C D E F G A B C Pythagoras 0 204 408 498 702 906 1110 1200 Aristoxenus 0 204 386 498 702 906 1088 1200
This has a better Major 3rd and Major 7th and is closer to the puretone temperament in that some of the the interval ratios in this scale are multiples of the prime numbers 2, 3 and 5 (the so-called 5-limit of primes); the only problem now is that the tones are of different sizes and are known historically as Major and Minor Tones. Even before Aristo- xenus, another theoretician called Archytas had proposed the use of 5:4 and 8:7 ratios as consonant intervals thus advocating the use of ratios within the 7-limit of primes.
Various other people had their two cents worth, so to speak, in order
to find ways of making ensemble playing and multi-part music in general
easier. In particular, it had been noted that people had a natural tendency
to sing intervals that were closer to being pure rather than the intervals
within the 3-limit, 2:1 and 3:2. Also, there were considerable difficulties
in fitting these intervals within the limits of a keyboard and make them
serve the requirements of the musical form. One major contribution to the
theories of temperament was Giuseppe Zarlino, the MaŒtre de Chapelle of
St. Marks in Venice, who in 1560 proposed inverting the Major and Minor
tones of the upper group in Aristoxenus's scale to relieve the monotony
of having two identically tuned halves of the scale. This gives us the
C D E F G A B C Zarlino 0 204 386 498 702 884 1088 1200This is, effectively, the puretone scaling. He then suggested reducing every fifth by two sevenths of a comma in order to lose the comma amongst the rest of the intervals. This method of redistributing commas was further refined by Francis Salinas, a blind musician and Professor of Music in Naples, among others. Here we have the start of Meantone temperament, the purpose of which is to redistribute the intervals such that the principle ones, such as fourths and fifths remain fairly true and others retuned so as to still fulfil their function within the scale. The most common way of achieving this is to flatten the first four fifths C-G, G-D, D-A, A-E reducing them enough to produce a true third - this also has the effect of removing the difference between the Major and Minor tones producing a "Mean" whole tone between the two, hence the name. Thus the Major thirds and the Minor sixths are true whereas the fifths are a little flat. The problem with this is that only keys that have few accidentals sound OK, others less so. This allows the use of the first six major keys in the cycle of fifths and the first three minor and also allows a certain degree of modulation from key to key.
One of the most problematical intervals is the fifth G#-D#. It is way too sharp and its inversion too flat - this is known historically as the Wolf Tone, so called because the mistuning was reminiscent of the howling of wolves - there are other wolves but this one is the most disturbing. The Wolf Tones are probably the main reason that composers of the period avoided using keys with a large number of accidentals. For example, Mozart rarely, if ever, composed any works in Db, F#, Ab and B Major or C#, Eb, F, F# and G# Minor as these keys make wolf tones stick out like a sore thumb. Curiously he also avoided B Minor which is all the more odd when you consider that his favourite key was D Major, closely followed by C and Bb Major. 
It is worth remembering at this point that the main reason for all this tomfoolery is the burgeoning development of the keyboard. Because there is a physical limitation on the number of keys which can be used to play notes, some means had to be found to permit the tonalities demanded by developments in polyphonic music to work within this limitation.  Incidentally, a good orchestra will effectively play in puretone tempera- ment but will constantly adjust its intonation so as to achieve the most concordant sound (remember that concordancy or discordancy is judged solely by its perceived effect on the ear) but with the pianoforte  becoming a more dominant force in Western composition and composers seeking to explore this new tonal palette, some means had to be found to facilitate their requirements.
Both Zarlino and Salinas knew about equal temperament but disliked the severe mistuning inherent in the thirds and sixths but, like the moving hand of Omar, progress moves ever on. A French monk called Marin Mersenne was probably the first person to calculate the equal tempered semitone, the basis for equal temperament, in around 1620 although some people accredit Simon Stevin, an organ tuner at the workshops of Andreas Werckmeister with the discovery somewhat earlier in 1608. There is also evidence to suggest that a Chinese gentleman by the name of Chu Tsai-yu worked it out several years before its calculation in the West. Since the guiding principle for equal temperament is the redistribution of the comma amongst all the intervals of the scale and not just certain ones as most variations on meantone temperament seek to do, the best way to do this is to find the twelfth root of 2, i.e., that number when multiplied by itself twelve times equals 2: this number is 1.059463094; this interval ratio is the equal tempered semitone. Composers now had, at least in theory, complete freedom to modulate to any key without hearing wolf tones - but at a price.
It has been suggested that J.S. Bach wrote "The Well-Tempered Clavier" for equal temperament but this is erroneous. Research by the American musicologist John Barnes in the Seventies shows that what Bach probably used was a variation on meantone temperament devised independently by Francescantonio Vallotti and Thomas Young. It is almost certain that Bach knew of the existence of equal temperament but would have never used it himself as it would have been impractical to tune a clavichord this way since its pitch alters depending on how hard the keys are struck; in extreme circumstances, the pitch can vary by up to a Minor 3rd.
It took nearly two centuries for equal temperament to find universal acceptance by the musical world; the first pianos to be tuned this way were produced by Broadwoods in the middle of the 19th century and by the beginning of the 20th, virtually all pianos were tuned this way. While equal temperament has its disadvantages, it has lead the way for the full development of harmonic music and the rich variety of musical styles which has grown up in the last one hundred and fifty years. One fact to note that the figures used to calculate all these scales are based on the theo~ retical values. In practice, even equally tempered instruments, such as the piano, sound flat in their upper octaves when they are tuned in strict accordance with the equal tempered scale. Piano-tuners employ a trick called, 'brightening the treble' or 'stretch tuning', which means that the top one and a half to two octaves are sharpened slightly; the low bass octaves are also lowered in a similar fashion.
The need for this technique seems to arise partly from anomalies with our aural perception at high and low frequencies and partly with mechanical inadequacies in the piano itself; outside of the range 64 Hz to 4100 Hz, we lose our ability to distinguish intervals correctly. On a purely subjective note, I have noticed that my perception of pitch alters at high sound pressure levels; music sounds "flatter" when played very loud  as well as altering the band of frequencies at which intervals can be distinguished so this is another good reason for keeping monitor levels down and slapping the client's hand (gently) when he reaches for that volume pot and tries to blast your compression drivers through the back wall of the studio and out into the carpark!!
One final point to bear in mind is the fact that the pitch standard
has varied considerably over the years. In fact, before the 15th century,
the pitch standard had ranged from a' 504.2 Hz to a' 377 Hz. The Mean Pitch,
proposed by Michael Praetorius in 1619 set the reference at 424.2 Hz. This
standard more or less lasted for over two centuries and agreed closely
with Handel's own fork (422.5 Hz in 1751) and that of the London Philharmonic
(423.3 in 1820). In 1859 a French Government Commission was set up to establish
a new standard as earlier in the century, with the development of brass
instruments, pitch standards had been steadily climbing because of the
increased brilliance of tone these instruments displayed at higher tunings
- in 1858 the standard at the Paris Opera was 428 Hz and in Vienna 456.1
Hz. The Commission settled on 435 Hz which was embodied by Lissajous in
a standard fork 'diapason normal' of 435.4 Hz which remains to this day
as the only legal standard. Over the years pressure from the military bands
once again forced up the standard and with the increase of broadcasting
and the consequent need to maintain consistency from orchestra to orchestra,
an International Conference in 1939 finally nailed the lid shut on the
debate and set a reference of a' 440 Hz @ 20 C. This reference gives us
the following frequencies for the tempered heptatonic scale:
c' 261.6256 d' 293.6648 e' 329.6276 f' 349.2282 g' 391.9954 a' 440.0000 b' 493.8833 c" 523.2511The twelve-note chromatic scale, of which there are two, is calculated by either multiplying the frequencies of the seven notes of the scale by 1.0417, which gives us the notes C#, D#, E#, F# etc or by multiplying by 0.96, which results in Cb, Db, Eb, Fb etc: these scales together are called the enharmonic scale. Notes in other octaves are obtained by multiplying or dividing by 2 an appropriate number of times - simple, eh?
Those of you who wish to pursue this fascinating subject further can find instant gratification in the following mighty tomes:
Feedback and comments can be addressed to:
Flat 1, 64 High Street
Note that these names are the original Greek ones and not the ecclesiastical names in use today. These would be Locrian, Ionian, Dorian, Phrygian, Lydian, Myxolydian and Aeolian.
Incidentally, if K = 300 then we have the Savart, an obsolete device much used in French literature
There are other devices, such as limmas, apotomes, diesises and schismas but their discussion here is beyond the scope of this article.
One possible explanation for his avoidance of B minor, at least for his keyboard works, is that in its ascending melodic mode, the scale throws up a G# which, while not exactly clashing, would sound odd in Meantone. Many organs of the period split the back half of the G# key to produce two separate keys sounding G# and Ab.
Several attempts have been made over the years, particularly in the 19th century, to develop keyboards with extra digitals, the most famous of which was a 53-note keyboard developed by R.H.M. Bosanquet, which can be viewed in the Science Museum, London.
OK, OK! Music historians get a gold star. At this point in history, composers were using the predecessor of our modern instrument, the fortepiano. This has a much lighter tone than today's piano and was strung differently using a wooden frame. Mozart's piano music, for example, tends to sound "bottom-heavy" on a piano whereas on the original instrument, the tone has more clarity.
In case you don't believe me, try this simple experiment. Find a piece of music that has a long sustained chord. Play this as loud as you can stand and then half-way through the chord, rapidly reduce the volume to a point when it's just audible - you'll notice the "pitch" of the quiet section apparently rise.
John Starrett's Framed Homepage with Trendy
John Starrett's Home Page Main Frame