I wrote a post yesterday about the missing fundamental effect. It's a startling auditory illusion in which your brain hears a note that is lower than any of the notes that are actually playing.

I decided to go to Desmos, an online graphing calculator, and play around with sines to see whether the missing fundamental is as strange as it seems. Remember that sound waves produced by voices and instruments are made up of many different sine waves. The lowest one is called the fundamental frequency, and the other ones are usually integer multiples of the fundamental frequency, also called harmonics.

To start off my music visualization, I graphed the functions y=sin(x) and y=sin(2x), which oscillates twice as quickly as sin(x) does. In musical terms, these would be pitches with a frequency ratio of 1:2, or octaves. Sound waves are additive, so I also graphed the function y=sin(x)+sin(2x). Like sin(x), this is a periodic function, and it has the same period as sin(x). Musically, it would sound like the same pitch as sin(x), but the timbre, or tone quality, would be different. The functions y=sin(x) and y=sin(2x) are shown in dashed blue and red lines, respectively. Their sum, the function y=sin(x)+sin(2x), is shown in solid black.

Then I graphed the functions y=sin(nx) up through n=7. You can see that there’s a lot going on, but the graphs all line up together a few times.

Below is the sum of all those functions. This is a periodic function with the same period as sin(x). Once again, we would hear the same pitch as sin(x), but the timbre would be different from the pure sine wave. The graph of the function y=sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x) is shown in solid black. The function y=sin(x) is in dashed blue.

Now we’ll visually create the missing fundamental effect. We'll start with the sine waves y=sin(2x), y=sin(4x), and y=sin(6x). They line up together twice as often as sin(x) does, so musically, we would hear a pitch an octave above sin(x).

Now we add sin(7x). Musically, the pitch of the wave sin(7x) would be two octaves and a minor seventh above the pitch of sin(x).Because 7 is odd, the graph of sin(7x) has a peak in some of the places where all the other graphs come together, and it changes the way the pattern repeats. You can see that the functions line up only half as often as the even functions did.

This is what the sum of the functions looks like.

The period of this function is the same as the period of sin(x). Yes, there is a noticeable bump in the middle where the period for sin(2x) was, but the waveform bears a strong resemblance to the one for the sum of all the functions from sin(x) to sin(7x). Below is a comparison. The function y=sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x) is shown in black, and the function y=sin(2x)+sin(4x)+sin(6x)+sin(7x) is in orange.

In practice, you would probably hear this as having the same frequency as sin(x), meaning that adding the high-frequency note sin(7x) lowers the perceived pitch. If we add more of the lower odd “harmonics,” we get something that resembles f(x) even more closely. The function y=sin(x)+sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x) is in black, and the function y=sin(2x)+sin(3x)+sin(4x)+sin(5x)+sin(6x)+sin(7x) is in blue.

After playing with those graphs, I’m no longer as surprised by the missing fundamental effect. It looks like a duck, so why shouldn’t it quack like a duck? But the experiment did make me rethink my intuitive idea of what it means to add sounds together. Our brains don’t have separate channels for each sound we hear. Everything goes in the ears, and when we find patterns, we interpret them as music, voices, car horns, or whatever. When we talk into a phone and the phone picks up the blue wave instead of the black wave, our ears hear something an awful lot like the black wave. Of course, real sounds are much more complex than the waveforms I made, but playing around with these graphs helped me understand more clearly why the missing fundamental happens. If you want to play with it for yourself, Desmos is only a click away.

This process, creating waveforms by adding trigonometric functions, is called synthesis, and we can reverse the process as well, starting with a periodic function and decomposing it into a sum of sines and cosines. This is called Fourier analysis, and engineering professor Bill Hammack has a great video series explaining a nineteenth-century machine called the harmonic analyzer that performs both synthesis and Fourier analysis mechanically. Warning: may cause you to yearn for a harmonic analyzer of your own.