Tuning and Timbre, Part I

This is the first of two posts that explore the connection between tuning (the location of notes in a scale) and timbre (the particular sonic character of a tone). In this post, we discuss the theoretical aspects of this connection, and in the second post we will build a little SuperCollider patch that will let us hear the theory. These ideas are due to William Sethares and you can find more information in his excellent article Relating Tuning and Timbre. If you’d rather skip the theory and go straight to the code, Part 2 is here.

In the beginning

We’ll start by giving a brief, opinionated overview of the foundations of just intonation.

Imagine two identical strings, fixed at each end, once twice as long as the other. If you pluck them, you will find that the shorter one resonates an octave above the longer one. Put another way, we can say that a 2:1 ratio of frequencies is perceived as an octave.1 This is not the only ratio of frequencies that corresponds to a musical interval. A 3:2 ratio is a perfect fifth, a 4:3 ratio a perfect fourth, and a 5:4 ratio a major third. Why is it that these ratios of small numbers are perceived by our ears as consonant intervals?

The ancient Greeks2 found this observation so mysterious that they concluded it must be a manifestation of some deeper harmony, one that also controlled the motion of the planets. Modern science, beginning with Helmholtz, has provided a slightly more down-to-earth explanation, which we will sketch out here.

Let us return to our two strings, one at frequency \(f\) and the other an octave above, at frequency \(2f\). These frequencies are the fundamental frequencies. However, each string is also (simultaneously) vibrating at a spectrum of other, higher frequencies, which are referred to as the upper partials. For a string, these upper partials are harmonic, which means that they lie at integer multiples of the fundamental: \(2f, 3f, 4f, 5f, ...\)3 In general, the upper partials get progressively softer, and usually only the first 5-6 contribute significantly to the perception of a tone.4

We are now prepared to understand why “small” fractions correspond to consonant intervals. A picture should help:

We have plotted five pitches with ratios 1:1, 2:1, 3:2, 4:3, and 5:4 (with respect to some arbitrary fundamental). As mentioned previously, these ratios correspond to the intervals of the unison, the octave, the perfect fifth, the perfect fourth, and the major third. We have also plotted the upper partials of each pitch. You’ll see that a curious thing happens: some of the partials of the higher tones coincide exactly with those of the root tone (these are the partials illustrated in orange). For the octave, we see that every partial coincides with a partial in the root. Mathematically, this is because we can express the partials of the octave as \(2f, 4f, 6f, 8f, ...\). For the fifth, every second partial is also present in the root (since \(2 \cdot \frac{3}{2} = 3\) and so on), and for the perfect fourth, every fourth partial overlaps with the root partials (\(3 \cdot \frac {4}{3} = 3\) and so on).

In general, any fraction will result in an interval in which some partials overlap (since \(n \cdot \frac{m}{n} = m\) for all integer \(n,m\)). Importantly, the “smaller” the fraction, the more coinciding partials there will be and the more consonant will be our perception of the interval. Finally, all of this rests on the harmonicity of the upper partials, i.e. the fact that they are at integer multiples of the fundamental.

Just for fun, let’s see what happens when we extend the graph above to cover the first 48 partials of the root and the first 24 intervals of the form \(\frac{n+1}{n}\).

Isn’t that pretty?

Non-spherical chickens

Is it really true that strings have harmonic partials? For an ideal string we can prove mathematically that the partials must be harmonic. An ideal string is one that is perfectly uniform, infinitely thin, and, once plucked, vibrates at constant amplitude forever and ever until the end of time. Obviously, such a string does not exist. Fortunately, however, most strings used in musical instruments are reasonably close to an ideal string, and so their partials are reasonably close to being harmonic.

What do we mean by reasonably close? In 1963, physicist and inventor of the hearing aid Harvey Fletcher measured the partial frequencies of piano strings.5

Here is his data for the D♯ below middle C:

n expected value actual value percent difference
1 152.6 152.6 0.00
2 305.2 305.8 0.20
3 457.8 459.2 0.31
4 610.4 613.0 0.43
5 763.0 767.9 0.64
6 915.6 924.3 0.95

We can see that the sixth harmonic is approximately 9 Hz or 1% sharp. As we move up the piano, the strings become more inharmonic. Here is the data for a high G:

n expected value actual value percent difference
1 777.2 777.2 0.00
2 1554.4 1558.1 0.23
3 2331.6 2348.0 0.70
4 3108.8 3148.7 1.28
5 3886.0 3966.0 2.06
6 4663.2 4800.0 2.93

Now the sixth harmonic is almost 3% sharp. Still, not too bad.

What about musical instruments that don’t use strings, like pipe organs, oboes, and saxophones? We can model these instruments as “ideal pipes” and calculate that they should have harmonic partials as well. (In fact, the math for ideal pipes and ideal strings is quite similar.) Just as before, real instruments are not exactly ideal pipes, but they are, for the most part, “close enough.”

Certain classes of percussive instruments, however, deviate significantly from inharmonicity. Among these are church bells, wind chimes, and xylophones. For examples, the partials of the xylophone have been reported to be at the following multiples: 1, 3.932, 9.538, 16.688, 24.566, 31.147. 6 This inharmonicity is what accounts for the unusual and beguiling timbres of these instruments. You may have noticed that even a simple major scale melody can sound quite mysterious when played on these instruments. Hopefully, by the end of this post, you will understand why.

Whither consonance?

How can we construct consonant intervals when using tones with inharmonic partials? The answer turns out to be quite simple: if we move the partials, we simply move the consonances accordingly. As before, we try and maximize the overlap of partials. How does this work in practice?

First, let’s generate some tones with inharmonic partials. Rather than consider a tone with completely arbitrary partials, let’s look at tones in which the partials have been “stretched” or “compressed” by a given amount. The formula below gives the locations of the partials \(f_n\) for a tone with fundamental frequency \(f_0\) parameterized by the inharmonicity parameter \(A\).

$$f_n = f_0 \cdot A^{log_2\ n}$$

If \(A=2\), then, by the definition of the logarithm, the formula reduces to:

$$f_n = f_0 \cdot n$$

which is just the standard harmonic (i.e. integer multiples of the fundamental) spectrum. When \(A>2\), the partials will be “stretched,” and when \(A<2\), the partials will be “compressed.” (We’ll hear what these timbres sound like in the next section.)

Given this partial structure, where should we place our perfect fifth? Obviously, if \(A=2\), then the fifth should be at 3:2, just like usual. If \(A>2\) (a “stretched” timbre), then we might expect the fifth to go a little sharp, and if \(A<2\), we’d expect the fifth to go a little flat. In fact, the position of the fifth can be written exactly as:

$$f_{fifth} = f_0 \cdot A^{log_2\ \frac{3}{2}}$$

You might want to verify that the second partial of this fifth is equal to the third partial of the root, just as we would want. In general, we can convert any fractional interval to the new system simply by placing it up there in the exponential and we will get the desired overlapping of partials that we discussed above for harmonic tones.

Theory and Practice

In this post, we’ve developed a method to adjust the positions of consonant musical intervals as a function of the positions of the partials of the particular tone that we are using. That is, we have related tuning to timbre. The method has a certain mathematical elegance, but does it sound any good? Stay tuned for Part II

  1. You might have noticed that we went from talking about string lengths to talking about frequencies. We can do this because the resonant frequency of a string is inversely proportional to its length. Thus, a 2:1 ratio of string lengths results in a 2:1 ratio of frequencies, but remember it is the shorter string that has the larger (higher) frequency. 

  2. We are speaking specifically here of the Pythagoreans. 

  3. In 2015, this is easily verified by making a recording of a tone and then computing the Fourier transform. The scientists of the 19th century had to employ considerably more ingenuity

  4. However, there is this lovely passage in Helmholtz: “On a string of the finest iron wire, such as is used in the manufacture of artificial flowers, 700 centimetres long, I was able to isolate the eighteenth partial tone.” 

  5. Normal Vibration Frequencies of a Stiff Piano String (pdf) 

  6. http://www.csounds.com/manual/html/MiscModalFreq.html