User:Sintel/The mathematics of temperaments

From Xenharmonic Wiki
Jump to navigation Jump to search

The mathematics of tuning and temperament (part 1)

These articles are aimed at people with a good grasp of mathematics and not necessarily music theory.

Just intonation

Musical intervals are usually associated with frequency ratios. For example, when you play a tone of 600Hz and 400Hz together, you get a frequency ratio of [math] 3/2 [/math], also known as the perfect fifth. Some important intervals are:

  • The octave: [math] 2/1 [/math]
  • The perfect fifth: [math] 3/2 [/math]
  • The major third: [math] 5/4 [/math]

To get the actual frequencies, a base frequency needs to be decided corresponding to [math] 1/1 [/math]. This is usually chosen as A4 = 440Hz, but you are free to choose this. To "add" or "subtract" intervals, we simply multiply or divide them. A major seventh is a fifth plus a major third: $$ \frac{3}{2} \cdot \frac{5}{4} = \frac{15}{8} $$ A minor third is a fifth minus a major third: $$ \frac{3}{2} \cdot \frac{4}{5} = \frac{6}{5} $$ We can also stack the same interval a number of times, by raising it to a power. Two times a perfect fifth makes a major ninth: $$ \left( \frac{3}{2} \right)^{2} = \frac{9}{4} $$ There is also a "zero" element: [math]1/1 [/math], called the unison. In this sense the intervals form a free module: [math] \left({\mathbb{Q}_{\gt 0}, \times}\right) [/math] over the ring [math] \mathbb{Z} [/math]. Because of the unique factorization theorem, the basis of this module is the set of prime numbers. In other words: every element of the module can be uniquely written as a product of prime numbers with integer powers: $$ \forall q \in \left({\mathbb{Q}_{> 0}, \times}\right) : q = \prod_{i=0}^{\infty} p_{i}^{a_{i}} $$ where [math]p_{i} [/math] is the [math] i [/math]-th prime number and [math] a_{i}\in \mathbb{Z} [/math]. For example: $$ \frac{36}{35} = 2^2 \cdot 3^2 \cdot 5^{-1} \cdot 7^{-1} $$ This way of thinking about intervals is known as just intonation.

Prime limits

It is widely accepted that the most useful intervals are those with relatively small numbers. We could look only at intervals with, say, numerators and denominators below 100. The problem with this approach is that it doesn't preserve any of the algebraic structure.

A better way is to look at submodules. Looking at the list of important intervals above, we notice that they don't contain any prime factors higher than 5. What if we restrict the generators to be only primes up to a certain number? We will define the [math]\boldsymbol{p}[/math]-limit submodule of [math] \left({\mathbb{Q}_{\gt 0}, \times}\right) [/math] as: $$ \mathbb{J}^{p} = \left\{ q \in \mathbb{Q} \, | \, q = \prod_{i=0}^{\pi(p)} p_{i}^{a_{i}} \right\} $$ Where [math] \pi(p) [/math] is the prime-counting function.

For example: 5-limit just intonation is the set of intervals generated by [math] \left\{ 2,3,5 \right\} [/math]: $$ \forall q \in \mathbb{J}^{5} : \, q = 2^a \cdot 3^b \cdot 5^c \text{ with } a,b,c \in \mathbb{Z} $$ Note that these submodules form a sequence: $$ \mathbb{J}^{2} \subset \mathbb{J}^{3} \subset \mathbb{J}^{5} \subset \mathbb{J}^{7} \subset \ldots \subset \left({\mathbb{Q}_{> 0}, \times}\right) $$ with increasing rank. You can view [math] \left({\mathbb{Q}_{\gt 0}, \times}\right) [/math] as the infinite-limit [math] \mathbb{J}^{\infty} [/math]. While these submodules still have infinitely many elements, they are finitely generated, which makes working with them a lot easier.

Pitch and logarithms

Earlier, we said that adding (subtracting) intervals actually corresponds to multiplying (dividing) the ratios. This is because our ear is logarithmic. The pitch then, is defined as the logarithm of the frequency. An interval is a relation between notes, so taking the logarithm of that results in a pitch difference.

The easiest units to work with are octaves, which you get by taking the logarithm base 2 (since [math] \log_{2} \left( 2/1 \right) = 1 [/math] ). Another unit that is often used is cents (¢). Since a cent is defined as 1/1200 of an octave, you can multiply the size in octaves by 1200. For the major third we find: $$ \log_{2} \left( \frac{5}{4} \right) \approx 0.3219 \text{ oct.} \\ 1200 \cdot \log_{2} \left( \frac{5}{4} \right) \approx386.31 \text{¢} $$ The logarithmic map naturally takes our modules under multiplication to modules under addition: $$ \log_{2}\left( \enspace \prod_{i=0}^{\pi(p)} p_{i}^{a_{i}} \right) = \sum_{i=0}^{\pi(p)}a_{i} \log_{2} \left( p_{i} \right) $$ Where the basis is now the set of log-primes. This has the added benefit that we can use the tools of linear algebra (over the integers). Because all [math] a_{i} \in \mathbb{Z} [/math], every [math]p[/math]-limit module is isomorphic to a free [math]\mathbb{Z}[/math]-module (free abelian group) with rank [math] \pi(p) [/math]: $$ \mathbb{J}^{p} \cong \mathbb{Z}^{\pi(p)} $$ This means we can write the elements in [math] \mathbb{J}^{5} [/math] as 3-dimensional integer vectors: $$ \frac{5}{4} \simeq \begin{bmatrix} -2 \\ 0 \\ 1 \end{bmatrix} \in \mathbb{Z}^3 $$ To get back the interval size in octaves, we multiply with the basis [math] \mathbf{g} [/math]: $$ \mathbf{g}v = \begin{bmatrix} \log_{2}(2) & \log_{2}(3) & \log_{2}(5) \end{bmatrix} \begin{bmatrix} -2 \\ 0 \\ 1 \end{bmatrix} = \log_{2}(5) - 2 \approx 0.3219 \text{ oct.} $$ The same procedure works in any [math]p[/math]-limit.

Continued in part 2