The Mathematics of Piano Tuning

Pythagorean chords

Good old Pythagoras (circa 460BC – 580BC) figured out by trial and error that two similar strings sounded very much the same when plucked. But then, he found that if a string was only allowed to vibrate at half the other string's length, the string's tone would be raised by a complete octave. The note sounded the same, only higher.

Needless to say he didn't stop there. If you halve the string again, the tone would be another octave higher, and halving it again... Plucked all at once, these strings all produced the same note, only higher and higher in tone. If he had doubled the length of the string instead of halving it, he would have achieved the same, only an octave lower.

Unfortunately, Pythagoras didn't stop there. He found that if you let the string vibrate at two thirds its length, the pitch would be just as pleasing as halving it, if not more. Pythagoras had hit on what is now called the perfect fifth. Good for him.

Then, in a fit of sadism, he restricted the vibration of the string to four-fifths its full length, thereby discovering the major third. That's right: a 2/3 of the length produces a perfect fifth, and 4/5 of the length produces a major third. Confused? Read on.

When the full length, the 1/2 length, the 2/3 length, and the 4/5 length were all plucked together, a refreshing chord was produced. The major chord had been discovered, and it was good (to our ears). So far so good.

The chromatic scale

But then, along came the Gregorian Chant and its accidentals. Oh, let's add a C sharp (C#) or G flat (Gb) et cetera, etc, &c they said - while Pythagoras turned uneasily in his grave.

Well, according to the human ear there are three distinguishable notes between the tonic and the third, and two between the third and the fifth, and another four between the fifth and the tonic an octave higher. That makes 12 tones.

Heavy mathematics and physics: Pythagoras vs. Gregorians

But you see, it just isn't so! Our ear tried to squeeze the tonic, third and fifth so that the "distance" between these tones is the same. It actually turns out that our ear hears tones logarithmically. A logarithm is the inverse of an exponential function, such as f(x) = 2x . But you'll see a demonstration of this in a moment.

Other logarithmic scales:

  • earthquakes (richters)

  • sound (decibels)

  • fractal dimension

The relationship between the frequency and the length of the string is simply:

f = k/L

This can be derived from:

  1. the fact that the string must produce a standing wave

  2. the formula v = (T/ρ)½

  3. the wave formula v = fλ

  • k is a constant determined by the thickness, weight and tension

  • L is the length

  • T is the tension

  • ρ is the mass per unit length

You can try manipulating 2 and 3 yourself — get rid of v and solve for f.

Eh????? Can we put it in a form easier to understand?

Well, let's try taking the ratios between two notes... k cancels out, so all we're left with is

f = 1/L

Easy! So, according to Pythagoras, if the tonic is 1 then the third is 1/(4/5) = 1.25 and the fifth is 1/(2/3) = 1.5. These relative frequencies produce a major chord. Perfect.

Technically, Pythagoras' chords are diatonic, while the Gregorian scale is tempered.

But! what does the Gregorian chromatic 12-tone conventional scale dictate? As we said, the frequency goes up exponentially, and our ear hears it logarithmically. That is: the first note is 1, the second note is 21/12, the third is 21/12 × 21/12, the fourth is 21/12 × 21/12 × 21/12,... the nth is 2(n-1)/12 .

Now here's the rub. According to Pythagoras, E (note 4) is meant to be 1.25, and G (note 7) is meant to be 1.5. But according to the Gregorians, E is 1.260 and G is 1.498. They're marked red in the table below.

The phenomenon of Beats

Hey, there's not much difference between 1.5 and 1.498, or 1.25 and 1.26, is there? Is there?? Actually, in music it's a significant difference.

Let me demonstrate. Click here to hear two frequencies very close to 440Hz.

Visually, the waveform is (b) below. The graphs show how the waveform is derived: The two waves are of slightly different frequency, and are both plotted together in (a). Now according to superposition, you simply add the two waves together to get the resultant, shown in graph (b). Our ears hear the change in amplitude (height) as a change in volume. So the sound produced gets louder and softer, louder and softer, producing the phenomenon known as beats.

Fourier Analysis and trigonometric identities show that the resultant waveform is y = 2ymcos(2π×½(f1f2)t×cos(2π×½(f1+f2)t).

From the graph and the formula above, it can be seen that the average frequency is ½(f1+f2)Hz and a beat will occur every (f1f2)-1 seconds.

Lets try an example to clear things up. The international frequency for E above middle C is 329.6Hz. The frequency according to Pythagoras (if C is defined as 261.6Hz) is 327.0Hz. Hence if you were to play both notes together, you'd hear a beat every 1/(329.6-327)=0.4 seconds. Or, if you were to try a G above middle C, there'd be a beat every 2.5 seconds. Both very significant.

So how about chords? A C-E Pythagorean chord doesn't have any beats. However, in the Gregorian standard there would be 5 times as many beats as there were for a single note. That is, there'd be a beat every 0.4/5 = 0.08 seconds. Similarly, for the C-G chord there are 3 times as many beats, i.e. 2.5/3 = 0.83 seconds (These values are for chords above middle C).

You see, Pythagoras' chords were perfect. That is, there aren't any beats if you play C-G-E using his particular lengths of string. However, the Gregorian scale means that you can't play C-G-E without beats!

Tuning a piano

So what does this all mean to piano tuning?

Well, you can tune a piano in many different ways, but you've got to first set the benchmark by tuning at least one octave (using the Gregorian scale, not Pythagoras).

In practice, you set each note according to the last, going up typically in 5ths, i.e. C-G-D-A-E-B-F#-C#-G#-D#-A#-F-C. But you have to tune each note slightly flatter than perfect, because of the difference between 1.498 and 1.5. By counting the beats you can tune it to have equal temperament, i.e. the relative frequencies go up exponentially by 21/12.

Endnote

It has only been with the use of computers that this technical analysis could be carried out. Older analyses have been with fractional approximations, such as demonstrated in Fischer's Piano Tuning: A complete guide. Computers have allowed me to use decimal approximations, which are less misleading when it comes to understanding harmonics.