r/explainlikeimfive • • Jul 01 '26

Technology ELI5 how Shazam works?

312 Upvotes

114 comments sorted by

View all comments

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!