Chunks of every song get turned into numbers called vectors, and those vectors get stored in a database.
When you record a bit of a song in the Shazam app, your recorded data gets turned into the same kind of vector numbers that they put in the database.
They compare the vector numbers from your recording to the vectors stored in the database. The closest set of numbers is probably a chunk of the song you’re looking for.
https://www.elastic.co/blog/searching-by-music-leveraging-vector-search-audio-information-retrieval
Latest Answers