See Pythagorean Tuning.

In music theory (over 40 years ago), the professor told us that perfect tuning to do with the ancient Greek philosophers, who had a big thing for logic and numbers.

Music was, in ancient times, taught as a branch of mathematics. Oh, and everything else was, too (justice is represented as the number 4, the stable sides of the cubic solid).

Pluck a length of tightened gutstring. Then pinch off the string against the sounding board, plucking it at exactly 1/2, 1/3, 1/4 of it's length, and so on. The relationship between the ratios and the sound is the very definition of music. There. Proof that music is math. (See details below.) This is, of course, exactly represented in the music of the spheres, which contain the various planets, which revolve around earth. The math can also be shown in the direct relationship between the five perfect platonic solids (Tetrahedron, Cube, Octahedron, Dodecahedron, Icosahedron) which represent each of the elements (earth, air, fire, water, and the void).

Pythagoras was a nut. A lot of the ancient goofiness is attributed to him. He thought of air, vapors, and gases as evidence of spirits and souls. Consequently, one should not eat beans, as it would lead to corrupting souls being released at the back end of the process. (told you he was a nut)

These guys had a whole bunch of goofy ideas that go along with the growing pains of a youngster first learning to think. The need for consistency where none can be found is a prime example of the kind of notion that troubled these fellows. That, combined with a disdain for observation compared to "reason" led to scholasticism, and the belief in a golden age of the past, hampering further advances.

The Pythagorean mathematical model would require a different keyboard to be played for every key change.

Other tunings are attempts to get around that requirement.

See, e.g.:

The Musical Construction of the World-Soul in Plato's Timaeus

Preamble:

The god, however, gave priority and seniority to the soul [of the world], both in its coming to be and in the degree of its excellence, to be the body's mistress and to rule over it as her subject.

The components from which he made the soul and the way in which he made it were as follows: In between the being that is indivisible and always changeless, and the one that is divisible and comes to be in the corporeal realm, he mixed a third, intermediate form of being, derived from the other two. Similarly, he made a mixture of the same, and then one of the different, in between their indivisible and their corporeal, divisible counterparts. And he took the three mixtures and mixed them together to make a uniform mixture, forcing the different, which was hard to mix, into conformity with the same. Now when he had mixed these two together with being, and from the three had made a single mixture, he redivided the whole mixture into as many parts as his task required, each part remaining a mixture of the same, the different, and of being. (Timaeus, 34c-35b)

Step One:

This is how he began the division: first he took one portion away from the whole, and then he took another, twice as large, followed by a third, one and a half times as large as the second and three times as large as the first. The fourth portion he took was twice as large as the third, the sixth eight times that of the first, and the seventh twenty-seven times that of the first. (35b)

This produces the following seven quantities: 1, 2, 3, 4, 9, 8, 27.

Step Two:

After this, he went on to fill the double and the triple intervals... (36a)

A double interval is one where the larger quantity is twice the smaller and a triple interval is one where the larger quantity is thrice the smaller. So we need to order our quantities in a way where they make these intervals. And sure enough, this works out to give us a double interval and a triple interval series:

Double interval series: 1, 2, 4, 8

Triple interval series: 1, 3, 9, 27

Step Three:

...by cutting off still more portions from the mixture and placing these between them, in such a way that in each interval there were two middle terms... (36a)

That is, each interval is divided into three, by inserting two middle terms between the extremes. So that looks like figure one.

Step Four:

...one exceeding the first extreme by the same fraction of the extremes by which it was exceeded by the second, and the other exceeding the first extreme by a number equal to that by which it was exceeded by the second. (36a)

The first of these rules describes the procedure for a harmonic mean and the second the procedure for a geometric mean. So these allow us to precisely place our two middle terms. This gives us figure two.

Step Five:

These connections produced intervals of 3/2, 4/3, and 9/8 within the previous intervals. (36a-b)

That is, the ratio of the larger to the smaller number in each of the nine intervals making up each of our two series will be one of these three values. That works out as shown in figure three.

In musical terms, the ratio 3/2 is called a perfect fifth. That is, when the ratio of the frequency of the higher note to the lower is 3/2, the musical interval that separates them is a perfect fifth. Similarly, 4/3 is a perfect fourth and 9/8 is a major second. So our two series can be understood as two systems of musical intervals, as shown in figure four.

This way of presenting the relationships considers the interval between each value (after the first) and the one that precedes it, so that each series is divided into three big intervals and each of these is divided into three small intervals, for a total of nine intervals making up the series. But we can also consider these series as a number of octaves (2/1 ratios) organized into scales, i.e. where we consider the ratio of each value to the value of the first member of the octave. On this way of construing them, the series consist of four major points, and within the span of each of these pairs there is a similar division consisting of four major points (i.e. sets of four points rather than sets of three intervals).

This is easy to show with the first ("double interval") series, since the major divisions correspond to octaves (2/1). It's a bit more awkward an analysis on the second ("triple interval") series, but in this case the first three points will make an octave, and we'll be left with an interval of a perfect fifth between our octaves. This looks like figure five.

By comparing the first kind of figure (showing individual intervals) to the second (showing scales), we can see how intervals are constructed from (or can be analyzed into) further intervals. Namely, an Octave is composed of a Per5 plus a Per4, and a Per5 is composed of a Per4 plus a Maj2.

Step Six:

He then proceeded to fill all the 4/3 intervals with the 9/8 interval, leaving a small portion over every time. The terms of this interval of the portion left over made a numerical ratio of 256/243. And so it was that the mixture, from which he had cut off these portions, was eventually completely used up. (36b)

Naturally enough, we'd like next to know how to analyze a Per4, and we'll have to construct the Per4 (4/3) out of Maj2s (9/8)--and that's exactly what Plato tells us. We're actually going to need two Maj2s, and even that won't be quite enough for a Per4. (E.g., the series {1, 1.12, 1.27} gives us two Maj2 [9/8] intervals, but it doesn't span far enough to get us to Per4 [4/3].) What we need to complete the Per4, having first added these two Maj2s, is exactly what Plato tells us: a 256/243 interval. (In the example just stated, that would give us {1, 1.12, 1.27, 1.33}, and that gives us a Per4, i.e. the interval between 1.33 and 1 is 4/3.) 256/243 is a musically significant ratio too, called a minor second.

So Plato explains a further step in the analysis here: an Octave is a Per5 plus a Per4, a Per5 is a Per4 plus a Maj2, and a Per4 is two Maj2s plus a Min2. (We can of course run with this: a Per5 is three Maj2s plus a Min2, and an Octave is five Maj2s plus two Min2s.)

Our construction of the first ("double interval") series involved two Per4 (4/3) intervals within each octave. If we now add this new division of Per4 intervals to this series, we get another layer of divisions within this series: each Per4 gets analyzed into three intervals (Maj2, Maj2, Min2) or into the four points that span these intervals. Considering all our analyzes, we now see that the series consists of three octaves, and each octave can be thought as five Maj2s plus 2 Min2s, as two Per4s plus a Maj2, or as a Per5 plus a Per4. This looks like figure six.

If we now construct this series as scales rather than individual intervals, we get three octaves, each consisting of eight notes, with the scale having the intervals: Unison, Maj2, Maj3, Per4, Per5, Maj6, Maj7, Octave. This looks like figure seven.

In modern terms, this is a major scale (although most modern instruments cannot play the mathematically precise intervals used in this system of identifying notes). In ancient terms, the key unit is a four note series called the tetrachord, and the octave is constructed by conjoining two tetrachords with a Maj2 interval separating them, which gives us the same construction (i.e. the tetrachords are the first four and the last four notes of the modern scale). In ancient music theory, there are different ways of dividing up the tetrachords, and the one Plato uses here, which corresponds to the modern major scale, is the Pythagorean scale derived from a similar mathematical procedure by Philolaus.

So Plato, following Philolaus' Pythagorean derivation of music from mathematics, constructs what is to us a major scale, merely on the basis of the ratios produced from a geometrical series analyzed into harmonic and geometric means. At least for the most part--the Min2 (256/243) interval seems to be needed simply to make up what's left over when we analyze the Per4 into two Maj2s. Note that this interval corresponds to what we would call a "semi-tone", which is the smallest interval used in modern music, corresponding to the space between two immediately adjacent notes (e.g. C to C#).