Technology · How it works
How Shazam turns a few seconds of a noisy song into a map of stars
Shazam’s original method throws away almost all of the sound, keeps a scatter of peaks its creators called a constellation map, and finds the song by lining up the stars.
Watch the film · 1:01
A song comes on in a crowded pub. Someone lifts a phone toward the speaker, and a few seconds later the title appears, through the chatter and the clinking glasses.
The trick behind that moment was laid out in public in 2003, in a paper called “An Industrial-Strength Audio Search Algorithm” by Avery Li-Chun Wang of Shazam Entertainment. The service was young then. Shazam began in the UK in 2002, when, as Apple recounted in 2024, users “would dial 2580.” According to the paper, the answer came back by text message, and the database held over 1.8 million tracks.
One caveat before we start. Everything here describes that published method. Apple has not published how today’s Shazam works, so this is the original trick, not a teardown of the current app. It is still a wonderful piece of thinking, and the paper’s own metaphor gave our film its name.
By the numbers
- Year the method was published
- 2003
- Tracks in Shazam’s database then
- over 1.8 million
- Size of each paired code
- 32 bits
- Codes that need to survive in a heavily corrupted 15-second sample
- about 1 to 2 %
- Number UK users first dialed
- 2580
- Song recognitions by November 2024
- over 100 billion
Technical figures are from Avery Li-Chun Wang’s 2003 paper, which describes the method as published then. The dialing number and the 100 billion milestone are from Apple Newsroom (November 2024).
Draw the sound, then throw most of it away
The first step is to turn sound into a picture. Shazam’s method builds a spectrogram, a chart with time running across and frequency going up, where every point shows how much energy the sound has at that moment and that pitch. (Strictly, the vertical axis is frequency, not perceived pitch, but pitch is a fair everyday stand-in.)
A spectrogram of a pub full of music and talk is a dense, smeared thing. So the method throws almost all of it away. It looks for local peaks: a point counts as a candidate if it carries more energy than every neighbor in a small region around it. The peaks are chosen so they cover the recording fairly evenly, so this is the loudest point in each small patch, not the loudest moments in the song. Even the loudness itself is then discarded. As the paper notes, “at this point the amplitude component has been eliminated.”
Why peaks? Because they hold up. “We settled on spectrogram peaks, due to their robustness in the presence of noise,” the paper says. A peak in the music tends to stay a peak even when someone is talking over it.
What remains is a sparse scatter of dots on a dark field, and the paper names it accordingly: “We term the sparse coordinate lists ‘constellation maps’ since the coordinate scatter plots often resemble a star field.” The “we” is apt: the patent the paper cites names two inventors, which is why our film credits Shazam’s creators, plural.
The film · 1:01
A Map of Stars
In a clay pub, a song rises from the speaker, freezes into a field of stars, and snaps into alignment with its match.
Watch more on Instagram Follow CERAMICO
Read the transcript
Shazam's original trick: turn a song into a map of stars. That's how it can pick out one song through a noisy pub. First, it draws the sound as a picture: time across, pitch going up. Then it throws almost everything away, keeping just the loudest point in each small patch. Its creators called the result a constellation map. Next, it links the stars in pairs: two frequencies, and the time between them. Each pair becomes a short code, and Shazam looks it up in an index of every song it knows. In a loud room, most codes get lost. Even if only one or two in a hundred survive, the right song's matches all point to the same spot in the track, like stars snapping into place. In 2024, Shazam passed 100 billion recognitions. All from a few seconds of sound, turned into a map of stars.
Animated model, illustrative and not to scale.
Pairs make the code
A single star is not very distinctive. Lots of songs have a peak at a given frequency. So the method links stars in pairs. It picks anchor points, gives each one a target zone, and pairs the anchor with points inside that zone, “each pair yielding two frequency components plus the time difference between the points.”
Those three numbers become a short code, a hash, and the paper notes that “each hash can be packed into a 32-bit unsigned integer.” Pairing is what makes the search fast; the paper reports a speedup of about 10,000 over looking up single points.
Every song in the catalog gets the same treatment ahead of time. The method runs over each track, and the resulting codes are sorted by value into one big index. When a clip comes in, each of its codes is looked up in that index, a little like finding a word in the back of a book.
There is a cost. A pair only survives if both of its stars survive, so pairs are more fragile than single peaks; the paper estimates the chance of a pair surviving as roughly the square of a single peak’s. The method gets away with it because of what happens next.
Finding the line in the noise
Many codes in a noisy clip will be lost. The clever part is how the right song stands out anyway. For every matching code, the method notes where the code sits in the clip and where it sits in the stored song. For the true match, those pairs share the same gap, because the clip is simply a slice of the song starting at one particular point.
Plot them, and the true song’s matches line up along a diagonal. Count the gaps in a histogram, and the true song shows a sharp spike at one value: the spot in the track where your clip begins. Put simply, the right song’s matches all point to the same spot in the track, like stars snapping into place. The paper describes it as sliding one constellation map over another until “a significant number of points will coincide when the proper time offset is located.”
The right song’s matches all point to the same spot in the track, like stars snapping into place.
That alignment is remarkably forgiving. In the paper’s words, “from a heavily corrupted 15 second sample, a statistically significant match can be determined with only about 1-2% of the generated hash tokens actually surviving.” One or two codes in a hundred is enough when they all agree.
The pub in our opening is from the paper too. To simulate real-life conditions, the authors used noise recorded in a noisy pub, mixed into clean clips at set levels. Success was not guaranteed: at the harshest levels tested, recognition dropped to about half. But the paper reports that the method “can correctly identify music in the presence of voices, traffic noise, dropout, and even other music.”
From 2580 to 100 billion
In 2003, the service took up to 15 seconds of audio, and the paper tested excerpts of 15, 10 and 5 seconds. The idea it describes needs only “a short matching audio sample of a few seconds length.”
On November 20, 2024, Apple announced the milestone: “Shazam has now officially surpassed over 100 billion song recognitions since it launched.” However the app has changed since 2003, the published idea remains a lovely one. Ignore almost everything. Keep the loudest point in each small patch. Link them into pairs, and let the right answer reveal itself when the stars line up. All from a few seconds of sound, turned into a map of stars.
Sources
Every line in the film was checked against these sources by an independent fact-checker before publication. Company claims are attributed to the company that made them.
Updates and corrections
- First published.
See an error? Tell us. We correct promptly and say what changed. Our corrections policy.
Disclosure
This is an independent explainer. CERAMICO is not affiliated with, sponsored by, or speaking for any company, brand, agency or person named in this story, and nothing here is official.
Claims are attributed. Where a figure or description comes from a company or an expert, we say so. CERAMICO is not affiliated with, or endorsed by, Shazam or Apple. Brand names identify the product only. The film and this article describe Shazam’s published 2003 method; how today’s app works has not been published. The animation is an illustrative model.
Animations are illustrative. Our films use clay-style 3D models. They are not to scale and are simplified to show how something works.
Trademarks and product names belong to their owners and are used only to identify what we are describing.


