How Does Shazam Actually Work?
Key point
A method for identifying songs from short, noisy clips using FFT and peak hashing.
Details
The sound picked up by a phone's microphone is stored as a waveform, but it's hard to compare directly once volume and playback environment change. Running FFT over short segments breaks the sound into frequency components, which are stacked to build a spectrogram.
- Only the strongest peaks in the spectrogram are kept, compressing it into a sparse set of points.
- Most background noise is discarded, leaving only the dominant frequency landmarks.
- This process runs on top of standard audio input, such as 44,100 Hz sampling.
Each peak becomes an anchor, which is paired with peaks inside a target zone to its right, creating a hash from the two frequencies and their time difference. Even a 3-minute song can produce thousands of these fingerprint hashes, and the result ends up being closer to a specific recording than to the song as a whole.
Instead of scanning songs one by one, the search uses a hash-first inverted index. Hashes obtained from the clip are looked up directly, and matches are further checked against the time offsets between matching hashes to reduce false positives.
- Server-based Shazam uses a large-scale fingerprint database,
- while Apple's on-device recognition and Google Pixel's Now Playing use a smaller local DB with ML optimization.
- The key isn't storing a lot of information, but precisely discarding the information that can be discarded.
The foundation is Avery Wang's 2003 paper An Industrial-Strength Audio Search Algorithm.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.