How do apps that recognize songs, like Shazam?

Spectrogram

Shazam and company have become one of those most amazing applications that we can carry on a smartphone. And it is not that they are not famous, because everyone already knows them, but it still seems almost magic that they are able to recognize which song is playing at any given moment. Let's see how apps like Shazam actually work.

Spectrography, the essential pillar

In reality, these applications are based on what we know as spectrography, or spectroscopy, that is, the body of knowledge related to spectroscopic analysis. And with these words it can be difficult to understand but we will explain it in a moment. When any sound is produced, we can hear it because the particles that are between us and the source of that sound move, vibrate. When we say that these particles move, we mean that they generate waves, which go from one place to another. The number of times these particles move back and forth is called the frequency, and surely we've all heard of the frequency of a sound, right? Well, spectrography, in this case, is dedicated to measuring the frequency of sounds in a certain period of time. Each sound has a different frequency at each moment, and that allows us to differentiate, on a spectrogram, which sounds are sounding.

It's all about comparing

How do you know what song is playing? Comparing. Actually, it is like taking an "X-ray" and comparing it with other X-rays of sounds that we already had stored, thus being able to know which of all matches that one. Well, this is exactly how Shazam and other apps work.

Spectrogram

Shazam is a spectrograph

When we start Shazam, and it tells us that it is recognizing the song, what it is actually doing is turning our smartphone into a spectrograph. It is capturing the sound and generating a spectrogram like the one you have just above this paragraph. Once you have a sufficiently detailed spectrograph, then you go on to compare it to the entire database they have stored.

The database is the most complex

In reality, the most complex of all is the database that stores the spectrograms of all the songs. We know how difficult it is to create a music service that contains all the music in the world. Spotify is one of those programs, but important songs are still missing from it. Well, if that is already complex, imagine what it must be like to store the spectrograms of all those songs. It is normal that part of the work of the team of Shazam and other similar applications is to dedicate itself to expanding the database that, in fact, is the heart of the application.

Its offline operation is very simple

Sometimes we might wonder how these applications can work offline, without an Internet connection. It is actually very simple, since they never give us the data until they connect to the Internet. They don't have to save the entire song, they don't even have to save the piece of music that we want to analyze. In reality, the only thing they keep is the spectrographic data, so that later they can be compared in the database, and that takes up practically nothing.

The algorithm is essential

However, another of the most important aspects of these applications is the algorithm they use to compare songs. An algorithm, in reality, is nothing more than a way of performing a procedure. Shazam's algorithm must be constantly improving. Why? Because they must work to get the system to follow a path that allows it to find the song even faster. And it is that one can think that once the spectrograms are understood and the database of songs is completed, everything is done, but nothing is further from the truth. Let's think that you should compare the spectrogram with millions and millions of songs. However, the algorithm is one of the main aspects. There are several computer techniques to improve this, and we are not going to talk about any in particular because it would be like talking about the shape of the Clouds on a stormy day. However, it is always good to know that the algorithm of the application is one of the essential elements, along with the spectrography function, and that of the song database.


  1.   theclinic said

    Chazam sucks. It is sooooo much better Soundhound or track ID from Sony.


  2.   The beattle said

    Interesting…