Tuesday, 29 June 2021

Equal Temperament Tuning

Part 1 of Mathematics and Music

On February 2nd 2018, I made a short post titled The Mathematics of Music and this current post builds on the content that I first introduced there.

The idea of doing a series of posts on Mathematics and Music occurred to me recently and one of the first and most basic topic in this regard were the ratios involved in the Western musical scales. I found a very good resource for this topic titled Why 12 notes to the Octave and the author begins with this statement:

The Greeks realised that sounds which have frequencies in rational proportion are perceived as harmonious. For example, a doubling of frequency gives an octave. A tripling of frequency gives a perfect fifth one octave higher. They didn't know this in terms of frequencies, but in terms of lengths of vibrating strings. Pythagoras, who experimented with a monochord, noticed that subdividing a vibrating string into rational proportions produces consonant sounds. This translates into frequencies when you know that the fundamental frequency of the string is inversely proportional to its length, and that its other frequencies are just whole number multiples of the fundamental. 

The key point is that "sounds which have frequencies in rational proportion are perceived as harmonious" and the most important of these ratios is 3:2. The author continues:

The chromatic scale reflects this fact. In the 18th and 19th centuries, the chromatic scale was tuned using the idea of 3/2. In the most elegant of these, Thomas Young's tuning, several of the fifths were set exactly to 3/2, and the others were tempered slightly (to make octaves exact).

In the modern equal temperament (which came into practical use during the early part of the 20th century), all fifths are tuned to 2^(7/12)=1.49651..., slightly less than 3/2, and 12 repetitions of this ratio gets us back to where we started (after dropping down 7 octaves).

Of the various intervals, the only ones that are really well captured by tempered versions of the 3/2 scheme are: unison, 5th, major 2nd, and their reciprocals (octave, 4th, minor 7th).

The author then asks two key questions: 

  • Why 3/2? The choice of 3/2 says that, next to the octave, it should be regarded as the most important interval. 

  • Why do 12 steps work nicely? Interestingly, this can be explained in terms of simple number theory, namely continued fractions.
Ah, continued fractions! This is where the Mathematics comes in. The author remarks that it is necessary to understand when a power of 3/2 will be close to a power of 2 (because 2 represents an octave and we want a power of 2 that will be close to a power of 3/2). So we set an equation:$$\begin{align} \left ( \frac{3}{2}\right )^a &=2^b \text{ where }a \text{ and }b \text{ are natural numbers}\\\frac{3}{2} &=2^{\frac{b}{a}}\\&=2^x \text{ where }x \text{ is a real number}\\
x&=\frac{\log \left ( \frac{3}{2} \right )}{\log(2)}\\

&\approx 0.584962500721 \dots \end{align}$$There are no rational values of \(a\) and \(b\) that satisfy the equation which is why it is necessary to approximate with a real number \(x\). The continued fraction approximations to \(x\) are shown in the SageMath code in Figure 1 with permalink included:


Figure 1: permalink

We see that 7/12 gives a reasonable approximation (0.5833333... versus 0.5849625...). If we start with the octave between note A3 (220 Hz) and A4 (440 Hz) and divide it into 12 semitones according to \(220 \times 2^{k/12}\) where \(k=0 \dots 12\), we get what's shown in Figure 2.


Figure 2: link

Figure 3 shows what two different representations of the octaves:

Figure 3: link

As the author of Why 12 notes to the Octave remarks, there are other possible divisions and one of them is into 19 parts because 11/19 = 0.578947... is pretty close to 0.5849625... and this produces the situation shown in Figure 4 where octave is divided into 19 "semitones" according to  \(220 \times 2^{k/19}\) where \(k=0 \dots 19\).


Figure 4:  link

Let's remember that the above scales, and in fact nearly all modern scales, use equal temperament. As Wikipedia explains:
There are two main families of tuning systems: equal temperament and just tuning. Equal temperament scales are built by dividing an octave into intervals which are equal on a logarithmic scale, which results in perfectly evenly divided scales, but with ratios of frequencies which are irrational numbers. Just scales are built by multiplying frequencies by rational numbers, which results in simple ratios between frequencies, but with scale divisions that are uneven.

This is a big topic and I've only scratched the surface of it. More later. 

No comments:

Post a Comment