# Fourier Series of Music

This is an article about a math discovery I made.

Click the link below to play with the web app

Introduction. What does an exponential waveform have to do with music and the notes we recognize? I discovered a mathematical function that displays a key insight into the unit of musical harmony. The motivation for finding this function was to see if there was a linear way to describe all the ratios in the chromatic scale (Pythagorean tuning). Pythagorean tuning is based on chains of fourths and fifths combined to reach every single note. Abstract. Tuning systems are based on pitch. It’s been found throughout every culture that if you take a string, pluck it, and compare the sound to another string twice its length (with equal tension), those two notes are equal. This is called the octave. Different tuning systems have been around since the time of the Ancient Greeks. The Greeks used two systems of tuning based on ideal integer ratios: Pythagorean and Ptolemaic. The major difference is, Ptolemaic tuning uses simpler ratios, where as Pythagorean tuning uses a chain of fifths and fourths. For example, a Major 3 in Pythagorean would be 81/64 where as in Ptolemaic it’s 5/4. Later music theorists, such as Gioseffo Zarlino[1] during the Renaissance, would prefer the Ptolemaic tuning system. Tuning systems based on ratios are called Just Intonation or Mean Tone Temperaments. The problem with Just Intonation is that the same ratios don’t translate evenly when you move from key to key. They create what are called “wolf intervals” which sound odd to the human ear. The solution was to switch to equal temperament — which divides the octave into 12 parts, all of which are equal on a logarithmic scale with a ratio of the 12th root of 2. The Pythagoreans used a method of tuning called the ‘chain of fifths’, where you multiply the pitch/frequency by a fifth (3/2) until you pass an octave. When you pass an octave, you take that same note, and move it down an octave by multiplying it by another ratio. Every ratio can be generated by a combination of 3/2 and 4/3. (This method is ascribed to an anonymous source in a book by Iacobus de Ispania in the 13th century)[2] For example, we will generate a scale starting from F.

F is called the unison in this case which has a ratio of 1/1. Going up a fifth we are on C. We got here by multiplying 1/1 by 3/2. If we go up another fifth we get to G.

Now we have a problem: 3/2 x 3/2 = 9/4. 9/4. is higher than an octave. The distance from F to G is a Major 2nd. We can reach this with our ratios going up a fifth and down a forth. In other words, we can multiply 3/2 by the inverse 4/3, ¾, to reach 9/8. (3/2 x 3/4 =9/8) Now that we’re at G, we can reach D by going up another fifth.

The Fifth up from D, is A. We can reach this by going up a fifth and down a fourth twice (from our original note F). Also known as two Major seconds 9/8 9/8 = 81/64. This method of going up a fifth and down a forth can continue forever. Source: http://www.medieval.org/emfaq/harmony/pyth4

The issue is this method of multiplying notes by different combinations of fourths and fifths does go on forever and never returns to 1/1. We will never be able to multiply a combination of fourths and fifths back to the original starting point. The first time we get close is 3¹²/2¹⁹ (which equals 1.013643). The next time we get close is 3⁵³/2⁸⁴(which equals 1.0020903). We would have to make a 53 note keyboard spanning 84 octaves if we wanted to get an extremely precise Pythagorean ratio based tuning system. It still wouldn’t be perfect and it isn’t very practical but with the advancements of computers and synthesizers — music with these concepts is already happening.

Now that we understand Pythagorean tuning and the old method of generating notes, it’s time to reexamine the ratios we have. I’ll start from unison and work to an octave going note by note.

No clear pattern emerges — so some rearranging needs to be done.

Now a pattern is starting to emerge, but there is something else to notice before we go further — every ratio is comprised of powers of 2 and 3.

Every pair of ratios with 3^x in the numerator and 3^x denominator always equaled 2. In fact, this can be viewed as one particular case of the equation below where p=3 and q =2.

In this python code, you can see how this pattern extends far beyond just beyond the Pythagorean ratios.

As you can see — if the ratio 3^x/2^n is greater than 2 — you add 1 to ’n’ term and the function continues. For this to be a linear function we have to get rid of the ‘if statement’. So the question turns into — what does ’n’ equal?

For any real number ‘q’ and ‘p’ > 0. This function generates a linear sequence of ratios strictly less than or equal to q, whose terms Rx1 * Rx2 = q

The upper and lower bound are given by the first pair of ratios (when x=0)

# For the particular case of q=2 and p=3 where the ‘x’ integer values intersect the function from 0 to 6… This produces a tuple of ratios that describes all the Pythagorean Ratios from the smallest numerator/denominator to the largest.

see graph at

[1] Chisholm, Hugh (1911). The Encyclopædia Britannica, Vol.28, p. 961. The Encyclopædia Britannica Company. [2] Schulter, Margo “Pythagorean Tuning and Medieval Polyphony”