Skip to Main Content
piano1

The mathematics of piano tuning



There is abundant material on the Web about the tuning problem. Brian Suits at Michigan Tech has an excellent Physics of Music site. The Connections site at Rice has a page on the Circle of Fifths. If you really want to know about pianos, see The Equal Tempered Scale and Some Peculiarities of Piano Tuning by Jim Campbell, on the Precision Strobe Tuner Home Page. Musical scales as psychological constructs is part of notes to a UCLA course by Systematic Musicology Professor Roger A. Kendall. Rayleigh's The Theory of Sound is available on the EnviroMeasure page. Edward Dunne's Pianos and Continued Fractions is in Neil Sloane's integer sequence archive. The wave equation and continued fractions are presented rapidly in Eric Weisstein's World of Mathematics, courtesy of Wolfram Research. A more elementary and attractive exposition of continued fractions is on Ron Knott's page at Surrey. For more bird songs you can check out my webpage at Stony Brook and the links therein. Sonograms and slow-motion bird songs are produced with Martin Hairer's Amadeus software.

1. Natural harmony

All musical instruments except percussion get their sound from the vibrations of strings or of columns of air. These motions are governed by the One-dimensional Wave Equation. Each stretched cord or open pipe has a fundamental frequency of vibration, its "note," which only depends, to a good first approximation, on the density, tension and length of the cord or on the length of the pipe.

But along with this note, the fundamental, each cord or pipe has a series of higher-frequency modes of vibration. A cord may vibrate as two cords of half its length joined end-to-end; or three cords of one-third the length, or four ... ; and similarly for the pipe. Since, with other things being constant, frequency is inversely proportional to length, these vibrations will give notes at twice, three times, four times ... the fundamental frequency. These notes are called the higher harmonics of the fundamental.

Here is an example from nature. The Hermit Thrush Catharus guttatus, fairly common in eastern North America, typically sings phrases where one long note is followed by a sequence of more rapid ones. Examine the sonogram record of this particular phrase from this particular bird. This record plots against time a frequency analysis of the sound; the color encodes the power delivered at the various frequencies. Here the first long note shows higher harmonics of order 2, 3, 4, 5, and 6 . The frequencies are 3531 (the fundamental), 6976, 10336, 13953, 17399 and 20758 cycles per second. In standard notation (A4=440) these correspond approximately to the notes A7, A8, E9, A9, C#10, E10.


Sonogram of Hermit Thrush song. Frequency is plotted vertically from 0 to 22050 Hz. Time intervals are in seconds.

The first note of the Hermit Thrush's song with its higher harmonics written as separate notes on a musical staff. The bird sings 4 octaves higher than scored.

Hear the song

Song at quarter-speed

The higher harmonics give a set of pitches that are naturally related to the fundamental. These pitches can then be heard by themselves. This is clear in the next example, where a Song Sparrow Melospiza melodia (common in eastern North America) alternates between the second and third harmonics (the fundamental is obscured by the second harmonic) in the beginning of its song.


Sonogram of Song Sparrow song. Frequency is plotted vertically from 0 to 11025 Hz. Time intervals are in seconds.

The beginning of the Song Sparrow's song. The bird sings 4 octaves higher than scored.

Hear the song

Song at half-speed

How to incorporate these natural harmonics into a musical scale is the basic mathematical problem in music. The problem already exists for the interval sung by the Song Sparrow, between the second and third harmonics (this interval is known in music as a perfect fifth). In this column we will examine this particular case and the approximate solution, known as Equal Temperament, which is used in tuning pianos today.

--Tony Phillips
SUNY at Stony Brook