Home

Music Speaks to Your Soul, Mathematics Can Tell You Why

Lachlan Vaughan-Taylor - February 22, 2022

The Beauty of Mathematics

Though it can seem dry at first, mathematics can embody a set of abstractions and conceptualisations that can only be described as beautiful.

With the data pathway gearing up to produce more lessons on mathematics to inform our other courses, I thought I would take the opportunity to share some of the more beautiful elements of mathematics that reveal relationships underpinning our fundamental experience of the Universe.

If you are after a business use (outside of operating a business in a universe built on these fundamental concepts), then buried within this, is the understanding that informs the way that the Power BI analytics automatic predictive tool works.

It may take a few articles but I thought a good place to start would be to share some of the mathematics of music, sound waves and how it is processed by the human brain. Biology and anatomy is my least strong area of knowledge, so apologies for any incorrect use of terminology there.

Music That Sounds Bad

I was raised in a fairly musical household. My father was a guitar player his whole life and my mother, a classical pianist. My grandfather was a singer in the philharmonic choir (Seen here performing stairway to heaven on Andrew Denton in 1989). As an angsty teen, I quickly rejected the music of establishment in favour of Death Metal, but being quite forgetful, I never remembered to bring my guitar pick to guitar lessons, so ended up learning classical guitar fingerpicking, instead of the chunky, brutal riffs that filled my iPod.

I’ve been playing for around 15 years now, and in that time I’ve managed to cobble together a relatively accurate understanding of music theory. While doing so, I found that mathematics was the most helpful tool in understanding why some notes sound good together and others sound bad ("bad" ="brutal" if you’re into Death Metal, "dissonant" if you’re into Stravinski).

So why do some notes sound harmonious together, whilst others sound dissonant and harsh?

As with any system, it's best understood by breaking it down into its constituents.

Music is just a combination of sound, and sound is just vibrations in air.

So let’s do some physics!

The first thing we need to do is explain what sound actually is.

Sound

A sound wave is a moving front of increasing and decreasing density, that transfers energy, without the transfer of matter. We usually think of sound as the vibrations in the air, but all matter can carry physical vibrations, that is sound energy.

The animation below shows a slow-moving wave, but sound in air moves at roughly 343 meters per second, each particle moving back and forth hundreds of times every second.

(Above gif taken from http://resource.isvr.soton.ac.uk/spcg/tutorial/tutorial/Tutorial_files/Web-basics-sound.htm)

The animation above shows what air molecules do as a sound wave passes through them. In the animation, watch the red dot carefully. It is oscillating back and forth, but it always returns to its rest location. This is actually what all of the molecules shown are doing. The wave moves, but the molecules oscillate/vibrate in place.

When a sound wave enters your ear, it causes this same motion that we see in the red dot, in tiny hairs within your inner ear. These hairs are connected to nerve endings that run information to the brain. This allows your brain to measure how fast the air is vibrating.

The length of these hairs determines the frequencies that they are able to vibrate at.

Imagine waving different sticks as fast as you can. You can wave a shorter stick much faster than a longer one. This is describing how the physical size affects the “Resonance Frequency” (more on this later).

Faster vibrations sound higher in pitch (treble) and slower vibrations sound lower in pitch (bass).

The number of oscillations back and forth each second is called the frequency of the wave.

The graph below the wave diagram shows this longitudinal compression wave, represented as a sine wave. This is the shape of the graph you get if you plot y=sin(x).

The sine wave can be a graph of molecule displacement, or of density, both will be a sine wave.

Here is what a pure, true sine wave sounds like: https://youtu.be/qNf9nzvnd1k

The sound will start at a low frequency, below the register of human hearing (don't crank the volume). As the frequency increases, you will start to hear the sound. It will then become too high in frequency for the human ear. (Your dog might hear it though)

If you have any hearing damage then as the sine wave runs through the frequencies that correspond to the damaged hairs in your ear, you may notice some tinnitus.

This shows you how the pitch of a note changes with frequency.

Let's pause and realise that we’ve just done something pretty cool.

We have linked a mathematical measure (frequency of a wave) to a biological model, which we’ve then linked to how our brain processes one of its most basic inputs, sound.

If you remember the early days of mobile phones you might remember all of the early monophonic ringtones.

Mono, Greek for one/single

Phonic, Greek for sound

These were songs played using single sine waves of different frequencies, one after the other.

This was definitely cool, but we didn’t really have music yet. No one would sit and listen to Motorola ringtones in their spare time. We need more than just monophonic to get that deep connection that humans have with music.

Wave Addition

This next section will involve a little math exercise.

I’d like you to go to GeoGebra: https://www.geogebra.org/calculator which is a fantastic resource for understanding functions in mathematics. Upon opening this link, many of you will sigh and realise how much frustration you would have been saved in high school if you had had the tools kids have today.

Step 1 Click on the f(x) tab to access the calculator's inbuilt functions.

Step 2 click ‘sin’

Step 3 click back to the numbers tab

Step 4 click x and hit enter

This process will add a sine wave to the graph.

If you then click into the input, you can add another function. This time repeat the process, but click into the function and change it to sin(2x).

We’ve now got 2 waves. By multiplying x by 2, inside our sine function, we’ve doubled the frequency.

In the time it takes our first wave to move up, down and back again, the second wave has done it twice.

Try inputting different values before x to see how it changes your wave.

Now we’re going to add 2 waves together.

We have already input these 2 waves.

Sin(x)

Sin(2x)

Lets now look at their sum:

Sin(x)+Sin(2x)

This is exactly how waves add together in nature. As waves move through each other, their amplitudes add together, creating a “superposition” of the 2 waves.

Ripples across the surface of water add their amplitudes, creating an “interference pattern”.

Try adding many waves to see what weird looking waves you see.

Think about the frequency of the resulting, repeating pattern you generate.

Fourier Theory

In this video, we see the wave pattern that we get from the sound of the presenter’s voice. You may notice that at 43 seconds we see something that looks a little bit like the graph of f(x)=sin(x)+sin(2x)+sin(3x)+sin(4x).

Followed by the presenter making a much higher pitched sound at 43 seconds, which looks more like a pure sine wave.

f(x)=sin(x)

Sounds like a whistle, a flute, a soprano singer, a male falsetto or a xylophone, usually consist of a small number of waves. The more complex or “warmer” tones can be made by stacking many waves on top of each other.

The cool part comes from a field of mathematics developed by Joseph Fourier in the 19th century. Fourier Theorem roughly states that any continuous function, can be written as the weighted sum of a (sometimes infinite) series of sine waves.

Any function or shape.

The sounds made by a violin, the static from a TV, the shape of the stock market value over time, an exponential growth, a logarithm, letters written out by hand on a sheet of paper. All of these can be represented as the summation of a series of waves.

For example:

This is the result of successive additions of terms in a series that looks like this:

y=sin(x)+sin(3x)+sin(5x)+sin(7x)+sin(9x)…

The more terms we add, the closer our series becomes to the square wave, approaching the true shape at infinity.

shows the difference in sound between the sine wave and the square wave.

All of the soul and natural timbre of every instrument, voice, or animal call, is just a matter of adding enough sine waves together.

If you want to see the slow build from pure sine waves to organic sounds, here is a video of Wendy Carlos, the pioneer of the synthesizer, creating a xylophone by stacking pure frequencies.  Jump to 2:40 for the demonstration.

This concept put into a rigorous mathematical statement:

The complex exponentials form a basis for L2 ([0,1])

Where L2([0,1]) is the set of functions f(t) on [0,1] for which:

[Citation]

Put into a less rigorous pseudomathematical statement:

"Everything is waves maaaaaaaannn"

The reason this works so well for our brains is that when that sound wave enters our ears, the structural build of our ears separates the wave into its Fourier series frequency components.

The wave sin(x)+sin(3x) will wiggle the hair in your ear that corresponds to sin(x) AND the one that corresponds to sin(3x).

Your brain takes the Fourier transform of the wave and represents it as a sum of frequencies.

Is the wave actually made of the many separate waves or is this only an approximation of its true nature?

The two are mathematically and physically equivalent. I leave the rest up to the philosophers.

Tune in next time and I'll talk about Resonance and the Harmonic Series.

If you want to break into the tech industry then sign up to our platform and begin your training today.

Join our community

We have a Discord server where you’ll be able to chat with your instructors and cohort. Stay active in your learning!
Join discord