Module 2 Β· Weeks 4–5 Β· Undergraduate β†’ Graduate

Tuning Systems & Diophantine Approximation

Every tuning system is a compromise. The mathematical question is: what is the optimalcompromise? This leads directly to continued fractions, Diophantine approximation, and the number-theoretic explanation for why Western music settled on 12 tones per octave.

1. The Comma Problem

Recall from Module 0 the Pythagorean comma: twelve pure fifths overshoot seven octaves.

\[\left(\frac{3}{2}\right)^{12} = \frac{531441}{524288} \cdot 2^7 \approx 1.01364 \times 2^7\]
\[\text{Pythagorean comma} \approx 23.46 \text{ cents}\]

But there is a second comma equally important in practice. The syntonic comma is the discrepancy between four Pythagorean fifths and a pure major third:

\[\frac{(3/2)^4}{2^2} = \frac{81}{64} \neq \frac{5}{4} = \frac{80}{64}\]
\[\text{Syntonic comma} = \frac{81}{80} \approx 21.51 \text{ cents}\]

The Pythagorean major third (81/64 = 407.82 cents) is noticeably sharper than the just major third (5/4 = 386.31 cents). This 21.51-cent discrepancy is the syntonic comma \(81/80\), and dealing with it is the central problem of Renaissance and Baroque tuning theory.

2. Taxonomy of Tuning Systems

Pythagorean Tuning

All intervals derived from pure fifths (3:2). Perfect for medieval parallel organum, but the major third (81/64) is too sharp for triadic harmony.

Just Intonation (5-limit)

Intervals tuned to pure ratios involving primes 2, 3, and 5. The just major scale:

C
1/1
0Β’
D
9/8
203.9Β’
E
5/4
386.3Β’
F
4/3
498.0Β’
G
3/2
702.0Β’
A
5/3
884.4Β’
B
15/8
1088.3Β’
C'
2/1
1200Β’

Just intonation gives pure intervals in one key, but modulation to distant keys produces accumulating comma errors. It is inherently non-transposable.

Meantone Temperament

The 1/4-comma meantone narrows each fifth by \(\frac{1}{4}\) of the syntonic comma, so that four fifths produce a pure major third \(5/4\). The meantone fifth is \(5^{1/4} \approx 1.4953\), or about 696.6 cents (vs. 702.0 for pure). This was the dominant keyboard tuning from roughly 1500–1750.

Equal Temperament

The radical solution: divide the octave into 12 exactly equal semitones.

\[f_n = f_0 \cdot 2^{n/12}\]
\[\text{Semitone ratio} = 2^{1/12} = \sqrt[12]{2} \approx 1.05946\]

The 12-TET fifth is \(2^{7/12} \approx 1.4983\) (700 cents), only ~2 cents flat of pure. The major third is \(2^{4/12} \approx 1.2599\) (400 cents), about 14 cents sharp of pure 5/4. Equal temperament sacrifices purity for unlimited transposability β€” every key sounds identical.

3. Continued Fractions & Why 12 Tones

The question β€œhow many equal divisions of the octave best approximate the perfect fifth?” is a problem in Diophantine approximation. We seek integers\(p, q\) such that \(p/q \approx \log_2(3/2) = 0.584962...\)

The continued fraction expansion provides the best rational approximations:

\[\log_2\!\left(\frac{3}{2}\right) = \cfrac{1}{1 + \cfrac{1}{1 + \cfrac{1}{3 + \cfrac{1}{1 + \cfrac{1}{2 + \cdots}}}}}\]
\[= [0; 1, 1, 3, 1, 2, 1, 1, 2, \ldots]\]

Convergents

The convergents of this continued fraction give the optimal EDO (Equal Division of the Octave) systems:

2-EDO
1/2
5th err: +15.0c
Tritone scale
5-EDO
3/5
5th err: -19.0c
Pentatonic
12-EDO
7/12
5th err: -2.0c
Standard Western
41-EDO
24/41
5th err: +0.5c
Excellent approx.
53-EDO
31/53
5th err: -0.07c
Near-just

Why 12 won

The convergent 7/12 is the first to achieve sub-cent accuracy for the fifth (βˆ’1.96c). The next improvement (24/41) requires more than triple the number of keys for less than 2 cents of improvement. Twelve is the β€œsweet spot” of the continued fraction β€” the convergent after a large partial quotient (3), which by the theory of continued fractions guarantees an exceptionally good approximation relative to the size of the denominator.

Simulation: Continued Fractions & Optimal Equal Temperaments

The simulation plots the continued-fraction convergents of logβ‚‚(3/2), the fifth error across all EDOs up to 60, a six-system cents comparison, and the syntonic comma on the 5-limit lattice.

Python
script.py245 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

4. Interactive Tuning Comparator

Hear the same chord in six different tuning systems. Select a chord type, then click any tuning card to hear it. Listen for the beating (interference patterns) in systems where intervals are not perfectly pure, and for the different β€œcolours” each temperament gives to the same harmonic progression.

Interactive Tuning Comparator

Select chord:

Continued fraction convergents of logβ‚‚(3/2)

The best rational approximations to logβ‚‚(3/2) = 0.58496... determine optimal equal divisions:

1/2β†’ 2-EDO
3/5β†’ 5-EDO
7/12β†’ 12-EDO
24/41β†’ 41-EDO
31/53β†’ 53-EDO

Click any tuning card to hear the selected chord in that system via Web Audio API. Audio plays for 3 seconds.

What to listen for

  • Just intonation major triad: perfectly still, no beating
  • 12-TET major triad: slight shimmer from the ~14 cents-sharp major third
  • Pythagorean major triad: noticeably bright/sharp third (81/64)
  • Meantone major triad: pure third, but the fifth is ~5.5 cents narrow
  • 31-TET: nearly indistinguishable from meantone
  • 19-TET: distinctive character, good thirds, flatter fifths

5. The Syntonic Comma & the 5-Limit Lattice

In 5-limit just intonation, every pitch can be expressed as \(2^a \cdot 3^b \cdot 5^c\) for integers \(a, b, c\). Ignoring octaves (powers of 2), pitches live on a 2D lattice with axes corresponding to factors of 3 (fifths) and factors of 5 (major thirds).

\[\text{Pitch class} \sim 3^b \cdot 5^c \pmod{2^{\mathbb{Z}}}\]

Moving right = multiply by 3/2 (fifth). Moving up = multiply by 5/4 (major third).

This is the Tonnetz (tone network), first described by Euler (1739). The syntonic comma \(81/80 = 3^4 / (2^4 \cdot 5)\) represents a closed path on the lattice: four steps right, one step down. In just intonation this path doesnot close (the endpoints differ by 21.5 cents). In meantone, the comma is β€œtempered out” β€” the path closes, and the lattice collapses from an infinite plane to a cylinder.

The topology of the Tonnetz changes depending on which commas are tempered out. Tempering the syntonic comma gives a cylinder; tempering both the syntonic and the enharmonic comma gives a torus. This topological perspective is developed fully in Module 6.

6. Xenharmonic Theory & Beyond 12

Xenharmonics is the study of tuning systems outside 12-TET. The continued fraction analysis shows that 12 is optimal for approximating 3-limit intervals (fifths), but other EDOs are superior for higher-limit intervals.

19-EDO

Approximates 1/3-comma meantone. Better thirds than 12-TET (6.5c flat vs. 13.7c sharp). Used by Guillaume Costeley (1570) and modern xenharmonic composers.

Fifth: 694.7c Β· M3: 378.9c

31-EDO

Approximates 1/4-comma meantone. Christiaan Huygens (1691) identified it as optimal for 5-limit harmony. Enharmonic notes split (Cβ™― β‰  Dβ™­).

Fifth: 696.8c Β· M3: 387.1c

41-EDO

Excellent for both 3-limit and 5-limit intervals. The β€œschismatic” temperament: the fifth is nearly just (702.4c), major third approximated via 8 fifths minus 5 octaves.

Fifth: 702.4c Β· M3: 390.2c

53-EDO

Known to Chinese and Arab theorists for centuries. Almost perfectly approximates 5-limit JI. Noted by Mercator, Newton, and Helmholtz.

Fifth: 701.9c Β· M3: 384.9c

Modern xenharmonic theory uses the framework of regular temperaments: a temperament is specified by the commas it tempers out, which determines its rank (number of independent generators) and its mapping from just intonation to tempered intervals.

The val formalism

An EDO is represented as a val: a homomorphism from the just intonation group to \(\mathbb{Z}\). For 12-TET, the 5-limit val is \(\langle 12 \; 19 \; 28 |\), meaning octave β†’ 12 steps, fifth β†’ 7 steps (since \(19 - 12 = 7\)), major third β†’ 4 steps (since \(28 - 2 \times 12 = 4\)). This algebraic perspective unifies all tuning systems in a single framework.

Video Lectures: The Math of Musical Scales

A three-part series exploring why we use 12 tones, the mathematics of tuning systems, and the role of number theory in music.

Math of Musical Scales, Part 1

Math of Musical Scales, Part 2

Math of Musical Scales, Part 3