Pi & recognizing voices and music

Photo: Jason Rosewell / Unsplash.com

🗣 “Hey Siri, call Grandma”
🗣 “Hey Google, play a song by Billie Eilish

A few years ago, you would have been called crazy if you claimed that your phone understood these commands. Nowadays, no one really blinks an eye. Your phone can even recognize entire pieces of music just by listening to it for a few seconds!

Via the app Shazam, your phone recognizes a song in just a few seconds. Photo Apple.com

How is it possible that a phone can actually listen and think like a human? We recognize our favorite song by using our brains. The melody and lyrics are linked by our brains to the correct title and artist. Basically, your phone does the same thing (recognizing and linking) yet slightly different. Computers are smart, but not as smart as our brains. Your phone cannot figure out by itself which song belongs to the sound signal that comes in. It uses a smart algorithm.

To understand this algorithm, we must first understand what sound actually is. Sound travels like an invisible wave. The sound you hear when you hit a guitar string looks like the animation above. If you hit a different string, you hear a different tone and the wave that goes with it has a different shape. So every sound has its own type of sound wave. Therefore, every singer, vocalist or musician produces his or her own sound waves.

The sound waves have been simplified for this animation.

The blue waves above represent the sound of all individual members of the band. If you add all these waves up, you get the red composite wave: the sound wave of the whole band. So the red wave is what you hear when you listen to a band or a song. Now the question is: how does your phone figure out which number belongs to that red sound wave?

A new example of a composite (red) wave. The red wave is decomposed into smaller blue waves. Animation: Lucas V. Barbosa .

For the sake of simplicity, let's say that the above red sound wave is the sound of the song Bad Guy by Billie Eilish. It would be nice if the phone recognized the correct title and artist from this red wave at once. Unfortunately, this is not possible because the red wave is much more complicated in reality. What the phone can do is decompose the red wave into all kinds of smaller waves: the little blue waves that you see in the animation. In this way the algorithm knows exactly what the red sound signal is made of.

Photo: George Prentzas / Unspash.com

You can think of these little blue waves together as a digital fingerprint. Your own fingerprint consists of a unique composition of lines on your finger. The digital fingerprint is unique in the same way because each number consists of a unique composition of waves. This fingerprint is then compared by your phone with the digital fingerprints of all numbers. Do we have a match? Then the title and artist appears on your screen!

Animation: Lucas V. Barbosa .

So the phone converts sound into a digital fingerprint and recognizes the number in that way. So where does the constant π jumps in? To obtain such a digital fingerprint, the waves must be chosen correctly. In doing so, your phone uses a mathematical technique in which π plays a role. Part of what makes a blue wave unique is the period of the wave. The period tells you how long it will take for the wave to go up and down.

The constant π plays an important role in waves because a standard wave (sine or cosine) has exactly a period of 2π. So the periods of other waves can be expressed in π. For example, if you want to make the period twice as short, you then divide 2π by 2 and you will get a period of π. Of course you can also make the period twice as long: the new period is then 4π. The constant π thus helps to determine which blue wave you are dealing with, while obtaining the fingerprint.

BACK To HOME

Vorige
Vorige

Pi & self-driving cars

Volgende
Volgende

Pi & the economy