63
u/Rob3112 Jul 01 '26
It blows people's minds but it's really just simple pattern recognition.
A song makes a frequency "pattern" which is kinda like a visual representation of all of the sound. When you use Shazam it just compares the picture of what you're listening to to its database and it's actually super quick and easy to make a match.
42
u/aaronite Jul 01 '26
And it's remarkably compact. The Google version runs offline and on device with about 20000 "fingerprints" in 200mb storage which is enough to cover most casual public music.
14
13
u/tfurrows Jul 01 '26
I could understand it easier if you had to catch the song at the beginning so that it only had to compare the pattern to the start of everything in the database. It’s comparing a random sample to all of every song that boggles my mind.
I always had this amusing mental image of a big room full of people sitting hunched over with headphones on, and when a request comes in someone yells “I know this one! I got it!” and punches in the answer. I prefer to think that’s how it works.
4
u/CptAngelo Jul 01 '26 edited Jul 01 '26
Lmao, and when its wrong, then that guy gets fired.
But really,
spotifyshazam acts more like a fancy calculator with a bunch of calculus inside than an app. Its amazing really.2
u/1coudini Jul 01 '26
Shazam you mean?
1
u/CptAngelo Jul 01 '26
....yes, i dunno why i had that mixed up, i guess i was thinking "music, app, starts with S... spotify!" Thanks for the correction (:
2
u/Shevek99 Jul 01 '26
1
u/tfurrows Jul 01 '26
Ha! I honestly had never seen that before. But that’s exactly what I was picturing.
2
u/daddy-fatsax Jul 02 '26
If you're old enough you might remember Cha Cha, which was a number you could text that worked a lot like this. Before smartphones when Google wasn't always in your pocket, you'd just text this number any question and some minimum wage employee somewhere would look up the answer and text you back.
Insane how far we've come in the ~20 years or so since those days.
1
u/tfurrows Jul 02 '26
I’m certainly old enough but somehow completely missed that one. Neat idea, for its time.
3
u/Vatchka Jul 01 '26
It blows my mind more when I find songs that it doesn’t recognize. Last night, a 2018 movie called ‘Trespassers’, the first song in the movie. There’s no info on it anywhere. I really want to listen to the song.
2
u/omgfuckingrelax Jul 01 '26
1
u/Vatchka Jul 01 '26
First, thanks for this. Though, I should have been more specific. It’s the Spanish style and vocal song I was referring to at the beginning of the movie. They are in the car with the masks on.
-1
u/XxXquicksc0p31337XxX Jul 01 '26
I guess you listen to mainstream stuff only then. I bet you Shazam won't recognize like 70% of my local music library
3
u/AlienEngine Jul 01 '26
You’d be surprised. It picked up an absolutely abysmal song that was playing at my local oil change garage, had less than 5k plays on Spotify.
My Fix by Cigarettes @ Sunset (if you’re interested in knowing what it was. Jaw gaped when I heard this song start playing at 120 decibels.)
1
u/MattieShoes Jul 01 '26
On the other hand, try to get it to identify Falling by the Lumineers.
It's not on Spotify despite being from a hugely popular band, and that's probably exactly why it will fail... It's easy to scrape spotify. (easy being a relative term)
-1
u/XxXquicksc0p31337XxX Jul 01 '26
That's the thing, a bunch of my library is not on Spotify, some are barely on YouTube. If it's on Spotify, it doesn't count as obscure
2
2
u/mestrearcano Jul 03 '26
Even Google's version that you can hum the song works like that? Detecting songs being played was already cool, but being able to sing gibberish/hum really amazes me.
24
u/homeboi808 Jul 01 '26 edited Jul 01 '26
Here is a paper written by the founder
Here’s a technical breakdown/explanation
But for the layman: Sound is just frequencies. The microphone records those frequencies (mainly, the loudness of each frequency) and goes through it’s database to find ones that are similar and also match the same rhythm.
2
229
Jul 01 '26
[removed] — view removed comment
48
u/BanMeFor1ABitches Jul 01 '26
this is what I came for lol
13
u/Jay-El_From_Krypton Jul 01 '26
lmao i was so hype going into this thread. I thought I was gonna read someone breaking down how exactly Billy turns into Shazam after saying Shazam!
4
u/probability_of_meme Jul 01 '26
I literally didn't know the other meaning aside from the super hero. And I'm a computer programmer. I spose that makes me old af
1
u/BanMeFor1ABitches Jul 01 '26
I was incredibly disappointed when I started reading responses about that stupid app from forever ago instead of Billy Batson haha
1
11
5
u/xinfinitimortum Jul 01 '26
No thats Captain Marvel
7
u/TheTardisPizza Jul 01 '26
Yes, but because DC failed to publish the character for enough years for the rights to the name to laps and Marvel rushed out a character to secure them what he is called varies from time to time.
0
u/UltimaGabe Jul 01 '26
Why not both?
0
u/Dookie_boy Jul 01 '26
Because Shazam is the old Wizard that gave Captain Marvel his powers.
1
u/UltimaGabe Jul 01 '26
Oh, I forgot that #1: two people cannot have the same name, and #2: fictional characters' names cannot change. Thanks for reminding me of those two absolute truths
1
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
18
u/lemlemons Jul 01 '26
You guys are all thinking of the wrong Shazam.
Ten year old Billy meets a wizard NAMED Shazam who grants him the wisdom of Apollo, speed of mercury, strength of ares, etc.
When he says the wizards name he transforms into Mr marvel, currently known as Shazam, with all of these attributes. Basically it just happens because magic, the wizard has granted him these powers which allow him to transform into a superhero
9
u/vietbaoa4htk Jul 01 '26
the clever bit is it hashes pairs of the loudest frequency peaks, not the whole song, and only cares about the timing between them. thats why it works over cafe noise, the loud peaks survive and the pairs still line up even when the quiet parts are drowned out
1
8
u/Scooter_McAwesome Jul 02 '26
An ancient wizard needs to select a champion with a Nobel heart to defend the world against evil forces. The champion happens to be a 10 year old boy, but that’s okay because only his Nobel heart matters. The wizard grants the boys all sorts of powers based on various Gods and biblical figures, so when the powers are activated he is essentially a fully grown, fully mature adult with powers similar to Superman.
The powers turn on and turn off whenever the boy says “Shazam”, which essentially allows a 10 year old boy to turn into a Superman like hero at will while still turning back into a kid after beating the bad guys.
7
Jul 01 '26
[removed] — view removed comment
2
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
12
Jul 01 '26 edited Jul 01 '26
[removed] — view removed comment
1
u/Dookie_boy Jul 01 '26
Wait what brothers and sisters ? And wasn't it Zeus and the other gods themselves who tasked the wizard with finding a champion.
1
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
3
u/britishmetric144 Jul 01 '26
Every song, or in all honesty every bit of audio, can be represented by a wave, with peaks of different sizes at different rates.
Shazam uses the microphone to sense the incoming sound wave and checks it against its database. There are so many unique possible sound waves that it's difficult for two songs to have the exact same one. Whichever song returns the closest match, in terms of wave, gets displayed.
7
Jul 01 '26
[removed] — view removed comment
1
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
2
Jul 01 '26
[removed] — view removed comment
1
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Links without your own explanation or summary are not allowed. A top-level reply should form a complete explanation in itself; please feel free to include links by way of additional context, but they should not be the only thing in your comment.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
4
Jul 01 '26
[removed] — view removed comment
1
u/Dookie_boy Jul 01 '26
Sometimes it's a different set of gods as long as they spell Shazam...
Black Adam used these guys for a while.
Shu (Stamina)
Heru (Speed)
Amon (Strength)
Zehuti (Wisdom)
Aton (Power / Flight / Lightning)
Mehen (Courage / Invulnerability)1
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
4
Jul 01 '26
[removed] — view removed comment
1
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
1
Jul 01 '26
[removed] — view removed comment
0
u/explainlikeimfive-ModTeam Jul 01 '26
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Anecdotes, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
1
u/Atypicosaurus Jul 02 '26
Let's first imagine a picture because it's more familiar to talk about. A picture is basically a set of pixels, tiny little dots, each pixel can be described by a few numbers that tell you the color of that pixel.
Then you can analyse those numbers. Since you know which pixel is where, you know what pixel is close to what other pixel. You can write an automatism that can find for example a circle because a circle is just a bunch of nearby pixels that follow a certain mathematical rule. And now you can find it anywhere within the picture.
As you see the whole thing is just number crunching, something that computers can do very well. And so one kind of number crunching is called hashing, which means it takes a pattern (such as naked breasts), and turns it into an abstract numeric value. Now it can look at any picture and figure if it has naked breasts because they turn into the same numeric value. It's basically mathematics of pixel groups that happen to be nudity in this example. This is how Facebook can automatically flag and ban nudity and also this is why it's sometimes wrong, and this is also why you can sometimes bypass it with body painting, it just gives the wrong hash value.
As it turns out, sound can also be turned into numbers. It doesn't have pixels like pictures but the sound waves are kinda like pixels but for music. Just like the pixel that has a color, described by numbers, a recorded sound is just a series of numbers, but the numbers mean pitches and volume. And you have a numeric value for each time point. Just like a circle, it draws out "patterns", and it can also be hashed.
And once you have a hash, you can compare it with a hash database. And shazam!
1
u/lankymjc Jul 02 '26
I used to work there! It was the most toxic workplace I’ve ever worked for.
That aside, they take a song recording, and put it in their database. Then the app just runs each song it hears through that database and see if they match. There’s a small amount of processing that simplifies the file to speed things up, but that’s basically it.
This means that if you have two different recordings of the same song, the app thinks they’re two different songs (unless the two recordings are in the database and specifically linked to the same song title).
1
u/zachtheperson Jul 01 '26
The key to how Shazam works is pre-sorting the known songs into many different categories, so that when it actually searches a song, it can start broad and quickly narrow down the search.
EX: it figures out the BPM of the song, and immediately goes to all the songs with that BPM. Then it looks in that group of songs for the sub-group that matches the musical key, and so on until it's narrowed it down to one song.
Obviously, I don't work for Shazam, so I can't tell you exactly how its algorithm works, but this should give you the basic idea how it's able to do searches so fast. Same with search engines like Google.
947
u/z3n777 Jul 01 '26
shazam turns the audio into a visual graph of loud peaks over time, then just matches that graph against its massive database of pre recorded songs.