# User:Sintel/The mathematics of temperaments

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 $3/2$, also known as the perfect fifth. Some important intervals are:

• The octave: $2/1$
• The perfect fifth: $3/2$
• The major third: $5/4$

To get the actual frequencies, a base frequency needs to be decided corresponding to $1/1$. 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: $1/1$, called the unison. In this sense the intervals form a free module: $\left({\mathbb{Q}_{\gt 0}, \times}\right)$ over the ring $\mathbb{Z}$. 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 $p_{i}$ is the $i$-th prime number and $a_{i}\in \mathbb{Z}$. 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 $\boldsymbol{p}$-limit submodule of $\left({\mathbb{Q}_{\gt 0}, \times}\right)$ as: $$\mathbb{J}^{p} = \left\{ q \in \mathbb{Q} \, | \, q = \prod_{i=0}^{\pi(p)} p_{i}^{a_{i}} \right\}$$ Where $\pi(p)$ is the prime-counting function.

For example: 5-limit just intonation is the set of intervals generated by $\left\{ 2,3,5 \right\}$: $$\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 $\left({\mathbb{Q}_{\gt 0}, \times}\right)$ as the infinite-limit $\mathbb{J}^{\infty}$. 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 $\log_{2} \left( 2/1 \right) = 1$ ). 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 $a_{i} \in \mathbb{Z}$, every $p$-limit module is isomorphic to a free $\mathbb{Z}$-module (free abelian group) with rank $\pi(p)$: $$\mathbb{J}^{p} \cong \mathbb{Z}^{\pi(p)}$$ This means we can write the elements in $\mathbb{J}^{5}$ 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 $\mathbf{g}$: $$\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 $p$-limit.