Remember learning trigonometry in school? Those pesky unit circles, right triangles, sines, cosines, tangents, the SohCahToa mnemonic… In this post I’m going to show how these basic concepts can lead to a deeper understanding of the fundamental nature of sound. Let’s begin with a commonly asked question: why do various musical instruments sound different even when playing the same note? For example, listen to a C4 note (middle C) being played on a violin, versus the same note being played on a flute:
Even though both instruments are playing a C4, our brains can easily differentiate between the violin and flute sounds. What is going on here? To answer this question, we first need to remember some basic trigonometry – starting with the unit circle. Think of a circle centered on the origin of a graph, with a radius equal to 1. Now any point along the edge of the circle will have an x-coordinate equal to sin(θ), and a y-coordinate equal to cos(θ):
Simple, right? Now imagine moving a point around the edge of the unit circle at a constant rate, and tracing its position on a graph through time:
Voila, we have our sine and cosine functions! Neat. So how can we apply this knowledge? Well, these simple functions are incredibly useful for modeling any kind of periodic behavior, including sound waves. Remember the C4 (middle C) sound on the violin? This note has a frequency of around 261.63 Hertz (Hz). Hertz is the standard unit of frequency and simply means cycles per second. Let’s make a sine function which repeats itself 261.63 times per second, and feed the result into an audio tone generator:
Interesting. It sounds sort of similar to the C4 violin note, but much more “artificial” and lacking… something. But what exactly? To figure this out, we need a new tool called Fourier analysis, named after French mathematician Baron Jean-Baptiste Joseph Fourier. It will allow us to check a signal for periodic behavior across a range (or spectrum) of frequencies. In our case, we can use it to analyze the spectrum of a sound wave to figure out what frequencies it contains. Fourier analysis is based on the concept of a Fourier Series, which is a way of representing any periodic function as a sum of sine and cosine functions as shown in the example below:
See how a single periodic function can contain many different frequencies? Next we can visualize the output from the Fourier analysis, with frequency on the horizontal axis, and amplitude (i.e. strength or loudness) on the vertical axis. First we’ll look at the basic 261.63 Hz sine wave we created earlier:
Notice the single peak at 261.63 Hz just as we expect. Now let’s add two more frequencies at 329.63 Hz and 391.99 Hz to form a C major triad:
We have three peaks exactly at our expected frequencies! How about something from the real world? Let’s go back to our C4 note played on the violin and run it through the same algorithm:
Woah, what’s going on here? We see a big spike at 261.63 Hz as expected, but also many smaller peaks spread out across higher frequencies. If we look carefully, many are located at integer intervals away from the fundamental frequency. These are called overtones, and are what give every instrument a unique timbre. When struck, plucked, blown through, etc., every instrument vibrates differently depending on its physical characteristics. In turn, different overtones are emphasized, which all add up to create a unique sound.
Hopefully you’ve gained some new insight into the fundamental properties of sound, and a better understanding of why various musical instruments sound different from one another. Thanks Baron Jean-Baptiste Joseph Fourier!