## A close look at Wendy Carlos' scales

essays math of music synthesizers
Last Updated:

NOTE: This essay was initially written for a university assignment. Since it was one of my favorite assignments to work on, I decided to adapt the essay into this article. :-)

NOTE 2: The mathematics was crosschecked for correctness with the textbook “Music: A Mathematical Offering”3.

Wendy Carlos was a true pioneer of synthesizers, and deeply helped popularize them. She was in fact Bob Moog’s first customer4, the now famous modular synthesizers maker. Previously used primarily in “under-the-radar experimental music”5, Wendy Carlos’ “Switched-on Bach” reinterpretation of Johann Sebastian Bach’s compositions brought synthesizers into the mainstream. This no surprise as the album achieved high success and popularity, being awarded three Grammy awards5. The close collaboration between Wendy Carlos and Dr. Robert Moog furthermore helped shape the synthesizers landscape: “It was a perfect fit, He was a creative engineer who spoke music: I was a musician who spoke science”4. Through her impressive catalogue of musical experimentation, she discovered a few musical scales, which she used in her album “Beauty in the Beast”. These music scales are the alpha-scale, beta-scale, gamma-scale and the harmonic scale. This essay will primarily focus on exploring the mathematics behind the alpha, beta and gamma scales and investigating the method through which Wendy Carlos discovered these scales.

Equal tempered tuning systems have been proven to be the best options among tuning systems, especially given their persistence through time. Ever since the $$12$$-tone equal tempered tuning system was introduced in the 1600s, no theorist managed to provide a better tuning system. Wendy Carlos experimented with equally tempered tuning systems, more precisely she set out to find new divisions of the octave. Her experimentation with octave division (presented in her article) is divided into two search experiments: Symmetric Divisions and Asymmetric Divisions. The difference between these two division lays in the intervals that are taken into consideration. Wendy defines symmetric intervals as the intervals which are inverse of each other with respect to the octave, for instance the perfect fifth ($$3/2$$) and perfect fourth ($$4/3$$). She consider the former to be a prime ratio, while the latter is “embedded in the combination”6 of the perfect fifth ($$3/2$$) and the octave ($$2/1$$).

Following inspiration from another program that searches divisions of an octave, authored by M. Yunik and G. W. Swift7, Wendy created a program that searches Symmetric Divisions of the octave, focusing particularly on recreating these intervals: $$\frac{3}{2}, \frac{4}{3}, \frac{5}{4}, \frac{6}{5}, \frac{5}{3}, \frac{8}{5}, \frac{7}{4}, \frac{11}{8}$$. It is noteworthy to mention that these to methods of searching ended up being vastly different. Since synthesizers are electronic devices that generate the sound, they can be configured with ease to abide by any tuning system. Wendy especially thought that there is no reason to “penalize what may be a fine division with more than two dozen notes”1, so she disregards the part of Yunik’s and Swift’s program that “penalizes” the scale system for every interval that is not close enough. The algorithm then follows:1

1. Calculate and store the cents for each prime ratio of interest. [...]
2. Set up a loop with some small increment on division size.
3. For each division size, calculate the size of one step, and set up and
clear the proper registers.
4. Find the nearest step to each given ratio and calculate its error.
5. Add the square of this error to the "sum-of-the-squares" register.
6. Plot that value, increment the division size, and loop to 3.


The program outputs a plot whereas the $$x$$-axis represents the size of a tone in the scale, and the $$y$$-axis is the error - a sum of squares of deviations. The search of divisions is a matter of finding local minimums on the plot, that are acceptable compromises. The plot produced by the Symmetric Search has found divisions which have been discovered before, such as the $$12$$ tone equal tempered scale that is commonly used, or the $$31$$ tone equal temperament scale. However, the real power of the program is searching divisions by modifying the list prime ratios of interest.

The search for Asymmetric division reflects the fact that inversions of the intervals are redundant6. Using the same program as before, however removing the symmetric ratios, Wendy started investigating non integer divisions of the octave. Her list of target intervals for this exploration was: $$\frac{3}{2}, \frac{5}{4}, \frac{6}{5}, \frac{7}{4}, \frac{11}{8}$$. The new plot showed three divisions which were surprisingly more consonant than the other divisions, between 10 and 40 equal steps6. The three divisions she found are the alpha, beta and gamma scales:

$$\alpha = 78 \text{cents/step} = 15.385 \text{steps/octave}$$
$$\beta = 63.8 \text{cents/step} = 18.809 \text{steps/octave}$$
$$\gamma = 35.1 \text{cents/step} = 34.188 \text{steps/octave}$$

For experimental purposes, a reimplementation of the program state above was attempted and can be found later in the article. This reimplementation only shows the baseline graph. Below is the graph Wendy originally created, where the alpha, beta and gamma values can be clearly noticed: Figure 1: Wendy’s plot of the Asymmetric Search 1

It is important to note that since the program plots out the error between approximating the ratios using a particular number of tones and the actual values, the peaks represent the points where the error minimal.

In order to analyze these new scales using Continued Fractions, there are a few particularities that are notable. Since the number of tones in an octave is not an integer, these scales are called non-octave-repeating, and due to the nature of how they were found, similarly to the B-P scale, we can consider the perfect fifth as being the basic interval of the scale. In other words, the problem of figuring out the interval becomes a problem of dividing the perfect fifth interval into an integer number of equal pieces. That means that in order to build the tones, we need to use the next harmonic interval - the major third - to generate the tones. Essentially, we want an integer number of major thirds to fall on an integer number of perfect fifths:

$$\left(\frac{3}{2}\right)^p = \left(\frac{5}{4}\right)^q$$
$$p = q log_{\frac{3}{2}}\left(\frac{5}{4}\right)$$
$$log_{\frac{3}{2}}\left(\frac{5}{4}\right) = \frac{p}{q}$$

Since both $$p$$ and $$q$$ are positive integers, we could use Continued Fractions to find good approximations for the left hand side logarithm:

$$log_{\frac{3}{2}}\left(\frac{5}{4}\right) = [0; 1, 1, 4, 2, 6, 1, 10, 143, 8, 2, 32, 1]$$

With the partial sums:

$$1, \frac{1}{2}, \frac{5}{9}, \frac{11}{20}, \frac{71}{129}, \frac{82}{149}, ... \text{ }$$

Since one of Wendy’s prime intervals is the minor third ($$\frac{6}{5}$$), we can add this interval to the error calculations below, to obtain a closer approximation. A perfect fifth can be composed of a major and minor third, from the triad 4:5:6, which means that a minor third is a major third “subtracted” from a minor third. On equally tempered scales, if the major third is $$px$$ tones (where x is the size of a tone in cents) and the perfect fifth is $$qx$$ tones, that means that a minor third is: $$qx - px = (q - p)x$$

Since we are trying to find the size of a tone/step in a equally tempered scale, let $$x$$ be this the size of each tone (scale degree), measured in octaves. Since the goal is finding the size of a tone to approximate major thirds and perfect fifths as well as possible, we can calculate the error:

$$f(x) = \left(qx - log_2\left(\frac{3}{2}\right)\right)^2 + \left(px - log_2\left(\frac{5}{4}\right)\right)^2 + \left(\left(q - p\right)x - log_2\left(\frac{6}{5}\right)\right)^2$$
\begin{equation*} \begin{split} f(x) = {} & (p^2 + q^2 + (q - p)^2) x^2 - \\ & 2\left(qlog_2\left(\frac{3}{2}\right) + plog_2\left(\frac{5}{4}\right) + (q - p)log_2\left(\frac{6}{5}\right) \right)x + \\ & \left(log_2\left(\frac{3}{2}\right)\right)^2 + \left(log_2\left(\frac{5}{4}\right)\right)^2 + \left(log_2\left(\frac{6}{5}\right)\right)^2 \end{split} \end{equation*}

In order to obtain the best approximation we must seek to minimize the error, or $$f(x)$$. A function f can only reach a local minimum only when the derivative $$f'(x)=0$$. Therefore we can obtain the tone size $$x$$ by:

$$f'(x) = 2(p^2 + q^2 + (q - p)^2)x - 2\left(qlog_2\left(\frac{3}{2}\right) + plog_2\left(\frac{5}{4}\right) + (q - p)log_2\left(\frac{6}{5}\right) \right)$$
$$f'(x) = 0 \implies$$
$$2(p^2 + q^2 + (q - p)^2)x - 2\left(qlog_2\left(\frac{3}{2}\right) + plog_2\left(\frac{5}{4}\right) + (q - p)log_2\left(\frac{6}{5}\right) \right) = 0 \implies$$
$$x = \frac{\left(qlog_2\left(\frac{3}{2}\right) + plog_2\left(\frac{5}{4}\right) + (q - p)log_2\left(\frac{6}{5}\right) \right)}{p^2 + q^2 + (q - p)^2}$$

Given that now we have the formula of finding the size of a step $$x$$, such that it would produce the minimal error for the target intervals, we can plug approximations obtained in formula  through Continued Fractions as values for $$p$$ and $$q$$. We observed that the first proper approximation in the partial sums of the Continued Fraction, $$\frac{p}{q} = \frac{9}{5}$$, yields a close approximation to the $$\alpha$$ value:

$$x = \frac{\left(9log_2\left(\frac{3}{2}\right) + 5log_2\left(\frac{5}{4}\right) + 4log_2\left(\frac{6}{5}\right) \right)}{9^2 + 5^2 + 4^2} \approx 0.064971 \approx 77.9652 \text{cents/step}$$

However, the next approximation of $$\frac{p}{q} = \frac{20}{11}$$, yields a close approximation of the $$\gamma$$ value:

$$x = \frac{\left(20log_2\left(\frac{3}{2}\right) + 11log_2\left(\frac{5}{4}\right) + 9log_2\left(\frac{6}{5}\right) \right)}{20^2 + 11^2 + 9^2} \approx 0.029249 \approx 35.0988 \text{cents/step}$$

The $$\beta$$ value can be obtained by means of an intermediate fraction:

$$\frac{1}{2} = \frac{0\cdot5+1}{0\cdot9+2} < \frac{6}{11} = \frac{1\cdot5+1}{1\cdot9+2} < \frac{11}{20} = \frac{2\cdot5+1}{2\cdot9+2} \text{ (Schettler, 2019)}$$
$$\frac{p}{q} = \frac{6}{11}$$
$$x = \frac{\left(11log_2\left(\frac{3}{2}\right) + 6log_2\left(\frac{5}{4}\right) + 5log_2\left(\frac{6}{5}\right) \right)}{11^2 + 5^2 + 6^2} \approx 0.053194 \approx 63.8328 \text{cents/step}$$

Since the denominator in these $$\frac{p}{q}$$ fractions indicates the ideal number of notes in the scale, we can furthermore conclude that the number of notes for each scale is:

step sizes number of notes
$$\alpha$$ 9
$$\beta$$ 11
$$\gamma$$ 20

Analogous to the $$5 + 7=12$$ divisions of the octave, we can notice that the perfect fifth can be divided into $$9 + 11 = 20$$ divisions2. In his article “Wendy’s Xenharmonic Keyboard”, Jordan Schettler presents a keyboard layout of the $$\gamma$$ scale that divides the perfect fifth into $$20$$ notes. Following the analogy with the octave, $$11$$ of the notes are the white notes on the keyboard and $$9$$ are the black notes. Figure 2: A perfect fifth on Wendy’s keyboard2

The real beauty of investigating the mathematics of Wendy Carlos’ scales lies in the method through which they were discovered - experimentally by writing a program. However, mathematical articles which are now talking about these scales are approaching them from a more theoretical stand point of view, describing how the alpha, beta and gamma values can be discovered through continued fractions. It really shows how a problem can be approached from multiples angles and how different methodologies can produce virtually the same result. More so, the discovery and analysis of these scales displays how an experimental approach followed by a theoretical investigation of the experiment can create wonderful results. Even though I enjoyed investigating both methodologies of getting to the same result, Wendy’s practical approach was more appealing to me, as it showed perfectly what it means to experiment: being aware of the abilities of the tools, trying out possibilities to seek one that works out, utilizing the idea into a piece of work.

# Wendy’s Program Implemented in Python¶

import numpy as np
import matplotlib.pyplot as plt

primes = np.array([3 / 2, 5 / 4, 6 / 5, 7 / 4, 11 / 8])
cents_of_primes = 1200 * np.log2(primes)

division_sizes = np.linspace(10, 60, num=1000)
step_sizes = 1200 / np.array(division_sizes)  # in cents

errors = np.array([
-np.sum((np.around(cents_of_primes / step_size) * step_size - cents_of_primes ) ** 2)
for step_size in step_sizes
])

x_axis, = plt.plot(division_sizes, errors)
plt.xlabel('notes per octave')
plt.savefig('plot.png') 