How did Western music settle on a 12 note scale

Historically our twelve tone system developed gradually, started with a seven tone system which developed from the historical Greek modes. This was constructed using pure fifths to make a chain of seven notes.

The five and seven note systems based on pure fifths are "moments of symmetry" in Erv Wilson's terminology - because they have only two step sizes. So for instance with the pentatonic scale the two step sizes are the minor third and the whole tone.

The next moment of symmetry after that, using pure fifths in a single chain to construct your tuning, is the twelve tone system, the so called “Pythagorean tuning”. It actually has two sizes of semitone - the diatonic and the chromatic semitone.

They added the "black keys" gradually. The first medieval keyboards had what we call the "white keys" with just one of what we now regard as the "black keys", Bb. To this day, this choice has its repercussions in German notation where they give B the letter H and Bb they call B dating back to the times when the B key was the only one that came in two different tunings (see B (musical note)). For more details about this history see Why twelve notes as one attractive arrangement.

Note - History of note names

After you add all the semitones, still the "circle of fifths" doesn't meet up so it's clear the system is incomplete. Another disadvantage of the pure fifths system is that if you follow the cycle C G D A E, the C - E there is sharper even than the twelve equal major third, so much so that in medieval times they treated it as a dissonance which had to be resolved.

Eventually in Western music, musicians settled on using the twelve notes, but tuning them in different ways. As major and minor thirds began to be important in music, the extremely sharp third in Pythagorean tunings was unacceptable to musicians, so they developed Quarter-comma_meantone, a system that has some of its major thirds pure, while its fifths are flatter than in twelve equal.

Then as composers began to modulate more and more to distant keys in the same piece of music, that became unacceptable too because quarter comma meantone is biased towards particular keys. Some of the intervals in the more distant keys (a long way up or down the cycle of fifths) in quarter comma meantone are tuned in strange ways. Modern composers sometimes use these intervals but it’s not what they wanted to play in those days so they just had to avoid those keys. To play in more distant keys, they then developed various Well temperaments This is what Bach explores in his “well tempered clavier”.

Then - in a parallel development, which only lasted a short time, before that time, there was a period of experimentation with more than twelve notes to an octave, with Vincento's 36 note to an octave Archicembalo isan example. Some of those 36 notes were used as duplicate keys, and one of its tunings used an approximation to 31 equal which gives you a good approximation to the pure major thirds and to quarter comma meantone, but is also a circulating system of 31 distinct keys instead of the 12 most of us are used to.

He used two manuals, tuned differently. Other instrument makers of the time used keyboards with split keys so you had many accidentals between the white keys.

Here is a performance of one of Vicentino’s own compositions played on a 24 tone harpsichord tuned using an extended meantone system.

0akGtDPVRxk

You can also hear a recording of a live performance of Vicentino played on a reconstructed Archicembalo, with many exotic transitions here Vicentino's enharmonic madrigals - SoundCloud

31 equal is a natural system to use if you want pure major thirds, frequency ratio 5/4. But it’s not so good for pure fifths.

If you continue beyond the 12 notes using pure fifths, you get another “moment of symmetry” at 17 notes but with very uneven sizes of note. If you keep going all the way to 53 notes you get a moment of symmetry with the intervals tiny and almost the same size, closely approximated by 53 equal.

Turkish and Arabic music gives another parallel development, also derived from the Greek modes, but instead of a circulating system of many keys, they ended up using a wider variety of intervals instead, patterns of intervals with different tunings, which they call Makams (http://en.wikipedia.org/wiki/Makam) in Turkey. It’s a complex sytsem which sometimes has the same note tuned different ways depending on the context (a bit like our melodic minor, but using microtones rather than semitone differences of pitch).

In their theory, they divide a whole tone into 9 commas, based on the Pythagorean comma (http://en.wikipedia.org/wiki/Pythagorean_comma) - and they have 24 pitches as a selection from a 53 tone system, but that’s only in theory, in practice they use many more pitches than that through pitch inflections of the notes and they don’t play exact 53 equal pitches either. So that is just a theoretical thing, and they aren't tuned exactly in that way and other systems with many more notes per octave are also explored for this music, for instance Ozan Yarman has explored a 79 tone system and made an instrument to use that for Turkish makam music.

You can compose in any number of equal notes per octave - Easely Blackwood did compositions in all the equal numbers of notes from 13 through to 24

aB4nwq8NGYI
 * “This tuning contains diatonic scales in which the major second spans three chromatic degrees, and the minor second two. Triads are smooth, but the scale sounds slightly out of tune because the leading tone seems low with respect to the tonic. Diatonic behavior is virtually iden­tical to that of 12-note tuning, but chromatic behavior is very different. For example, a perfect fourth is divisible into two equal parts, while an augmented sixth and a diminished seventh sound identical. The Erude is in a sonata form where the first theme is diatonic and the second is chromatic. The development modulates entirely around the circle of nineteen fifths. An extended coda employs both diatonic and chromatic elements.”

Basically any twelve tone system has to be a compromise. The fifths are by themselves already impossible to tune in all the keys to pure 3/2s, though you get a reasonable compromise for those in twelve equal. The major thirds are much harder to tune because you want three of them to stack to an octave in a twelve tone system and if you try that using pure Major thirds, they they are way out, After stacking three pure major thirds, the gap between the last note and the octave is the diesis of 41 cents, nearly half a semitone.

To start with the well temperaments were quite a bit different from twelve equal and favoured some scales more than others. Gradually they became more even as music got more adventurous, but Chopin still was using keyboards tuned in well temperaments. Nowadays of course they have smoothed out so much that nearly everyone plays in twelve equal.

So - in short - it is for historical reasons, like the qwerty typewriter. The twelve tone system does have some special properties - it is a moment of symmetry for the Pythagorean tunings, with only two sizes of semitone if tuned to pure fifths, and those so similar in tuning that you can to a reasonable approximation just tune them the same if you are only interested in fifths and don't mind a slight beating of your fifths easily noticeable in sustained chords.

It's not so good though for major and minor thirds, and when it comes to septimal chords e.g. bluesy minor it can't do them at all, just very rough approximation, and when you get to neutral thirds based on the eleventh harmonic it can't even approximate those. The 24 notes to an octave quarter note system used by many modern composers does a good approximation of neutral thirds but it can’t handle the septimal ratios.

So - it is a compromise, limits your palette, which for some composers may be a good thing, less to think about. Also of course many composers worked with it so a lot of past history to draw from. Also any tuning system has it's own particular "feel" to it, so you can't say that because the twelve equal system gives poor approximations to the major and minor third that it is "wrong" - it is just itself, it is just part of the "feel" and "gist" of twelve equal. You get used to thirds that beat strongly and it just feels natural and that's how they are, they are kind of lively and exciting - and for musicians who are highly trained and used to twelve equal it can come to the point where any other tuning of the intervals actually feels wrong.

So, it is one of many different tuning systems, an interesting one but by no means the only one to use.

For a very different approach to tuning you might like to have a listen to Gamelan music - each "Gamelan" is a whole orchestra of instruments, constructed as a single large instrument, and each Gamelan has its own tuning - like every orchestra tuned in a different way.

Universal scales?
The twelve tone system is a good one, and a flexible one - but just one of many good tunings. There doesn't seem to be much evidence of universality as there are many musical cultures with completely different tuning systems and nothing resembling the twelve tone system. Historically, only the "western European" musical culture developed it as the main system of tuning.

However, the pentatonic scale is more or less universal.

Pervasiveness of Pentatonic scale

That depends what you mean though - if by pentatonic, you just mean any five note scale (including for instance approximately five equal tuning) that's not saying so much. But the major and minor pentatonic is also found in many different traditions - not necessarily a Pythagorean pentatonic scale tuned to pure fifths, but approximately the same tuning.

Some examples given here

Further Pentatonic musical traditions

You find it even amongst the earliest bone flutes, some old enough that they might have been made by Neanderthals. They come in different tunings, however some of them have finger holes which seem to be set to a pentatonic tuning.

So - the major and minor pentatonic might be the nearest claim there is to a universal scale. Amongst humans anyway.

Universal scales cross species?
Amongst animals that sing - such as birds - few of them sing in anything like any of our musical scales, at the micro-tuning level - it's true that musicians like Messian transcribed bird song to the twelve tone system but most of the original songs don't really fit that tuning if you listen to them in detail, it is just an approximation to what they sing.

So - the pentatonic scale might just be universal to humans as a species rather than to musical expression generally, not sure how you could find out unless we some time encounter a musical civilization with beings of another species. In "Close encounters of the third kind" the beeps used to communicate with the aliens in the film use four of the five notes of the pentatonic scale. It's perhaps our best guess at a "universal scale" but you couldn't really say that there is good evidence to expect musical ETs to use it.

It's fun to speculate about what we might have in common with a musical ET if we ever encounter such.

The individual musical intervals such as a fifth, major and minor third, octave, etc, have good claims to universality, since they are based on pure frequency ratios. and occur almost universally in human cultures, especially the octave. Since they are musically and mathematically simple to describe, they might perhaps be expected to be shared even with musical ETs (similarly to maths).

So you could ghhasbdhjbprobably expect a musical ET to relate to the individual intervals that make up the tune, but that might be as far as you could go. At least judging by other animals and birds on the Earth and how they use musical intervals, their musical culture might well use them in different ways from us.