How The Heck Does Shazam Work? (An Interactive Exploration)
You're at a coffee shop. A song comes on. It's right on the tip of your tongue. You pull out your phone, tap a button, and it tells you what it is in a few seconds.
How does a phone listen to a few seconds of music through a noisy room and instantly match it against millions of songs?
Your first instinct might be that the phone is listening to the melody or recognizing the lyrics. It's neither of those. What it's actually doing is far more clever.
Reverse Engineering Sound
TL;DR
Your phone captures sound as a waveform using a very thin membrane. This waveform is not useful for song identification, so a process called the Fast Fourier Transform is used to convert it into a three-dimensional representation of sound called a spectrogram.
Your phone's microphone uses an extremely thin membrane called a diaphragm to measure the vibrations in the air caused by sound. Those vibrations are converted into an electrical signal, which is digitized into a waveform: a sequence of numbers representing air pressure at each instant in time.This is similar to how your eardrum catches those same pressure waves, but while your brain turns them into sound, your phone turns them into a sequence of numbers.
Read the full article at perthirtysix.com