What do beaches, image compression, and singers have in common?
December 16, 2021
Literally no matter where we are in the universe, something is blowing up, moving back and forth, or shrinking and expanding. I’m talking about the largest thing you can imagine, down to oscillations at the quantum mechanical level. Whatever it is, I can guarantee you that waves are somehow related to any of these things. It’s one of the most fundamental aspects of nature because energy is transferred through waves, but waves are a lot more relevant to our own lives than you would think.
If you picked up a phone, it’s using so many different kinds of waves like electromagnetic (light, radio, microwave, infrared), sound waves, and gravity because… well it’s just always there. Waves power the world, and if you want to learn more, I highly suggest you stick around.
Let’s start with something we’re all very familiar with. Sound.
Sound and Amplitude
The way sound works is relatively easy to understand. If you and I were to have a conversation, air is pushed out by our lungs which passes through the larynx (the voice box) to create sound. How loud we are is most affected by how much air we exhale while speaking. This loudness, or more generally known as the intensity, is called amplitude. Amplitude most of the time implies how energetic something is, and if it isn’t, it can at least be interpreted in that way.
But how does sound acquire a pitch? I’ll get into that in just a second, but let’s first talk above waves.
Waves and Frequency
There are two kinds of waves, the technical jargon being longitudinal and transverse waves. We’re most used to seeing transverse waves, both in math class and in real life. For example, when we look at the audio of a song we see, for lack of a better description, wavy lines. We see that the peaks and the valleys for a transverse wave are oriented vertically while the wave itself travels through space horizontally. The easiest way to remember is to trace out a transverse wave. You have to move your pencil up and down while moving from left to right.
Frequency is what describes how scrunched up the peaks and valleys are… sort of.
Just think of it from a logical perspective. If you are spinning around in a circle, the faster you spin, the more often you complete a full rotation. That also means if the rate at which I’m spinning increases, the more spins I can fit in 5 seconds. It’s the same story with waves. different frequency, same amount of time
For example, if machine A emits 20 waves in 10 seconds but machine B does 30 waves in 10 seconds, machine B has more waves “squished” together in the same amount of time. Frequency describes how many waves are transmitted in a single unit of time. So in this case machine A shoots out 2 waves per second while machine B shoots out 3 waves per second, implying B has the greater frequency.
The standard unit of measure for frequency is Hertz [Hz], which represents the number of cycles/waves per second. 1 [Hz] = [1 cycle / 1 second]. So if a wave has a frequency of 20 [Hz], that’s the same as doing 20 * [1 cycle / 1 second] = [20 cycles / 1 second]
Pitch
What even is pitch? Well, it is the reason why we don’t live in a completely monotone world. Pitch allows us to distinguish one sound from the other. It is the result of different frequencies of sound. The higher in pitch something is, the higher the frequency the sound is. So if I play a B flat (466.164 [Hz]) I know that it is higher-pitched than a D (293.665 [Hz) because the air “vibrates” more frequently. What I mean by vibrate is complicated, so we’ll save it for the end.
Timbre
Okay, so the loudness of a sound comes from the amplitude of the wave while the pitch comes from the frequency. Makes sense. Now imagine that because of my outstanding musical talent, Ariana Grande and I are making the next hit single. While warming up, we might sing a scale in unison on the same octave. Do Re Mi Fa Sol La Ti Do.
Using what we know, what happens?
We would sound exactly the same. I mean this literally. Our singing would be indistinguishable from the other. The notes sung would sound exactly like pure tones but at different frequencies. The music would sound godawful, to say the least, but on the bright side, at least the playing field is even.
Which brings us to the question, how is it possible that we can sing the same note but sound different? How come one person’s voice sounds different than another? How come instruments can sound so unique?
There are two main reasons: the envelope and harmonics. I won’t go into detail about the envelope, mostly because it’s less interesting in my opinion, but I encourage you to Google it if you want to learn more.
The Envelope
Here’s the meaningless definition of the envelope: the envelope represents the structure of a sound wave. Wow, thanks Wikipedia.
Imagine you traced all the peaks and you do the same with the minimums. Those two lines essentially show how the sound wave changes in intensity. For example, smacking a bell has a much more drastic envelope than a very gradual crescendo of a clarinet. This helps us distinguish sounds apart, but it’s not the full story.
And now we get to the juicy bit.
Fourier Transforms (it sounds worse than it is)
When I first heard of Fourier Transforms I thought I was way in over my head, but it’s actually quite easy to understand it without diving into the math (which I do not fully understand either). In this quick overview, I’m going to be borrowing the fantastic explanation from the book Grokking Algorithms.
Imagine you walk into a bar and a stranger walks up to you, holding a smoothie. They need a favor from you and you seem like an honest person, so they ask “what did I put into my smoothie?”
You might respond with “Why would I know weirdo?”, but then you remember that you have your magic formula that can decompose anything into its parts: 10% banana, 20% strawberry, 45% water, etc.
Sound is a lot like a smoothie. It’s a mix of many many different tones, each with different intensities and frequencies, and when you layer them on top of one another, you’re able to get unique sounds. The Fourier Transform is a mathematical operation that can decompose a smoothie of sound into its frequencies along with how much each frequency composes the sound.
The reason why this complicated wave gets its shape is due to destructive and constructive interference. Essentially, parts of the wave can add together, which can either subtract/cancel out (think of a peak added with a valley) or add (think a peak added with a peak).
The Fourier Transform and its related concepts are so cool because it is used literally everywhere in math, engineering, and physics. One great but relatively unfamiliar application is images. A technique called the Discrete Cosine Transform is used all the time in compressing files like images, audio, and video. But how does it work?
As we saw earlier, a wave can get a complicated shape by the sum of several other waves. You can go in the reverse direction and use a bunch of simple waves to try and approximate a more complicated wave. When I say wave in this case, I use the term loosely because you can use it to approximate any kind of function to some extent. It’s a powerful tool and an incredibly useful one at that.
Longitudinal waves (sound is complicated)
Truthfully, I’ve been beating around the bush. So far I’ve only talked about transverse waves because transverse waves are really nice to deal with. Sound in real life can get complicated very quickly, not because it’s difficult to understand how it works but due to the sheer amount of interactions that happen. There are probably trillions of particles flying around us every second, and their collisions are closely linked to how sound travels. So many factors can influence how sound travels like the density of the material, elasticity, and temperature, not to mention where the particles are even located. The point is, longitudinal waves are a headache. animation showing particle motion for a longitudinal pressure wave highlighting the difference between particle motion and wave propagation.
Waves are the transfer of energy. No physical thing is moving from point A to point B. If you look at the animation, the highlighted red particles are staying in the general area of where they start, yet somehow a wave forms. This is because the collision of particles transfers energy from one particle to the next, which moves the crest of the wave further in the direction of the collision.
Try to picture this animation as looking at ocean waves from the top down, especially if you look at the far right of the animation. We see the wave crash onto the beach, but thin out, eventually receding into the ocean until another wave comes by.
The amplitude of a longitudinal wave is basically how compressed the particles are at each point, so if particles are close together, it has a high density and therefore a high amplitude. The frequency is how far about the waves “lines” are spaced apart, so the closer together the waves are, the higher the frequency. Amplitude and frequency still have the same properties, it’s only a matter of translating them to the specific kind of wave.
Luckily, we don’t need to deal with longitudinal waves. Converting from a longitudinal wave to a transverse wave is relatively easy because as I mentioned earlier, amplitude is the same as density in this case. If the particles are packed, there is peak, if they are spread out, there’s a minimum. Simple Plane Wave Animation If you plot the density of a wave on an XY plane, you get a transverse wave!
This is exactly what a microphone does. It takes the vibrations from the air and converts them into a digital signal (which is a transverse wave).
Final Thoughts
While I focused almost entirely on sound, the underlying principles of sound waves can be applied everywhere, if you look hard enough.
I learned a lot of these concepts from working on a science fair project with my friends and I thought that I’d share more about the project and how it worked. I’m just scratching the surface, so I hope you stick around for the remaining posts.
We essentially created a concept device, one that can assist hard of hearing individuals in navigating their environment. If you want to learn more about the project, click on the card below.
Otherwise, thanks for reading. Stay curious.