# How does Shazam work?

**URL:** https://boards.straightdope.com/t/how-does-shazam-work/560627
**Category:** Factual Questions
**Created:** [November 14, 2010, 7:21am UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627 "2010-11-14T07:21:52Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Tim\_R.Mortiss](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tim_r.mortiss/32/142_2.png) [@Tim\_R.Mortiss](https://boards.straightdope.com/u/Tim_R.Mortiss)
#### Post date: [November 14, 2010, 7:21am UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/1 "2010-11-14T07:21:52Z")

</div>

\*Shazam \*is a software service that listens to a few seconds of a song, and then tells you the title, artist, album, and of course gives you the option to purchase it. But how the heck does it work?

I’m guessing there is some sort of Fast Fourier Transform involved, but I don’t really know. Their website gives nothing away. Anyone have the straight dope? Thanks!..TRM

---

<div class="post-metadata">

### Author: ![Francis\_Vaughan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/francis_vaughan/32/3093_2.png) [@Francis\_Vaughan](https://boards.straightdope.com/u/Francis_Vaughan)
#### Post date: [November 14, 2010, 7:49am UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/2 "2010-11-14T07:49:27Z")

</div>

Their website is pretty tight, and the company is privately held, so there isn’t a requirement for public disclosure of other useful information. However the terms and conditions contain the key pointer. The patents. U.S. Patent Nos. 6,990,453, 7,346,512, 7,627,477, 7,739,062.

6,990,453 is _System and methods for recognizing sound and music signals in high noise and distortion._

And so it goes.

They are not going to tell you which of the methods are used, and how much of any method is used in the production system. But you can get a pretty good idea. Have fun reading.

---

<div class="post-metadata">

### Author: ![Uncertain](https://avatars.discourse-cdn.com/v4/letter/u/6a8cbe/32.png) [@Uncertain](https://boards.straightdope.com/u/Uncertain)
#### Post date: [November 14, 2010, 8:14am UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/3 "2010-11-14T08:14:08Z")

</div>

Some info can be found [here](http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf) and [here](http://laplacian.wordpress.com/2009/01/10/how-shazam-works/). As I understand it, they do a short time Fourier transform and pick some peaks as signatures.

---

<div class="post-metadata">

### Author: ![Tim\_R.Mortiss](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tim_r.mortiss/32/142_2.png) [@Tim\_R.Mortiss](https://boards.straightdope.com/u/Tim_R.Mortiss)
#### Post date: [November 15, 2010, 5:15pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/4 "2010-11-15T17:15:24Z")

</div>

Thanks, fellas! I knew the Dope would sort it out…TRM

---

<div class="post-metadata">

### Author: ![Rhythmdvl](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rhythmdvl](https://boards.straightdope.com/u/Rhythmdvl)
#### Post date: [November 15, 2010, 5:21pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/5 "2010-11-15T17:21:18Z")

</div>

What the heck is a short time Fourier transform, and where is the relevant XKCD?

ETA

> [@](#):
>
> and where is the relevant XKCD

Wow. I was kidding, but: [Fourier](http://www.xkcd.com/26/)

---

<div class="post-metadata">

### Author: ![RealityChuck](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/realitychuck/32/195_2.png) [@RealityChuck](https://boards.straightdope.com/u/RealityChuck)
#### Post date: [November 15, 2010, 5:26pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/6 "2010-11-15T17:26:59Z")

</div>

Obviously, it works using the wisdom of Solomon, the strength of Hercules, the stamina of Atlas, the power of Zeus, the courage of Achilles, and the speed of Mercury.

---

<div class="post-metadata">

### Author: ![Duke](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Duke](https://boards.straightdope.com/u/Duke)
#### Post date: [November 15, 2010, 7:10pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/7 "2010-11-15T19:10:14Z")

</div>

> [@RealityChuck](#):
>
> Obviously, it works using the wisdom of Solomon, the strength of Hercules, the stamina of Atlas, the power of Zeus, the courage of Achilles, and the **speed of Mercury**.

Honestly, I don’t think it takes a computer program to figure out whether you’re playing Queen or not.

---

<div class="post-metadata">

### Author: ![Rhythmdvl](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rhythmdvl](https://boards.straightdope.com/u/Rhythmdvl)
#### Post date: [November 15, 2010, 7:59pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/8 "2010-11-15T19:59:43Z")

</div>

> [@Duke](#):
>
> Honestly, I don’t think it takes a computer program to figure out whether you’re playing Queen or not.

Isis what you did there.

---

<div class="post-metadata">

### Author: ![Malacandra](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@Malacandra](https://boards.straightdope.com/u/Malacandra)
#### Post date: [November 15, 2010, 8:23pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/9 "2010-11-15T20:23:56Z")

</div>

A wizard did it.

---

<div class="post-metadata">

### Author: ![Tim\_R.Mortiss](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tim_r.mortiss/32/142_2.png) [@Tim\_R.Mortiss](https://boards.straightdope.com/u/Tim_R.Mortiss)
#### Post date: [November 15, 2010, 8:39pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/10 "2010-11-15T20:39:58Z")

</div>

> [@Malacandra](#):
>
> A wizard did it.

Or Gomer Pyle.

---

<div class="post-metadata">

### Author: ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)
#### Post date: [November 15, 2010, 8:48pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/11 "2010-11-15T20:48:41Z")

</div>

> [@Rhythmdvl](#):
>
> What the heck is a short time Fourier transform, and where is the relevant XKCD?
> 
> ETA
> 
> Wow. I was kidding, but: [Fourier](http://www.xkcd.com/26/)

See the mouseover text in [this one](http://www.xkcd.com/523/)  
The big F in [this one](http://xkcd.com/55/) means Fourier transform

---

<div class="post-metadata">

### Author: ![Rhythmdvl](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rhythmdvl](https://boards.straightdope.com/u/Rhythmdvl)
#### Post date: [November 15, 2010, 9:01pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/12 "2010-11-15T21:01:05Z")

</div>

Not one, but _three_ XKCD links? Awesome.  
ETA: I still don’t understand what it is. The wiki page is beyond my abilities to follow. It looks like a graph of sound, but how is it different from what appears on the spectrum analyzer of an equalizer (or is it the same thing?).

---

<div class="post-metadata">

### Author: ![Jas09](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@Jas09](https://boards.straightdope.com/u/Jas09)
#### Post date: [November 15, 2010, 9:19pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/13 "2010-11-15T21:19:25Z")

</div>

> [@Rhythmdvl](#):
>
> ETA: I still don’t understand what it is. The wiki page is beyond my abilities to follow. It looks like a graph of sound, but how is it different from what appears on the spectrum analyzer of an equalizer (or is it the same thing?).

It is comparable to a spectrum analyzer, at least in theory. There are actually a number of different variations, but the basic idea is transforming a time-domain function (like the sound-wave of a song) into a frequency-domain function.

Another way of thinking of it is breaking a complex repetitive signal into into its constituent frequencies.

A constant A note would transform into a spike at 440 Hz. Two notes would have two spikes. More complicated waveforms would produce more complicated transforms.

Shazam appears to take a time-slice of the song (say, a second or less) and do an FFT and isolate the peaks (basically the points in time where a dominant frequency exists). They map these points into a “identifying code” of sorts, and attempt to find a song that has these codes in the right relative times… if that makes any sense at all. If they get enough matches in a short enough time interval they declare a hit.

One of the articles linked above has a very nice description of the process, as well as some useful images.

NOTE: When talking about taking the Fourier transform of a sampled, finite-time function (like a time-sample of a song), they are actually using a Discrete Fourier Transform (DFT). These days, Fast Fourier Transform (FFT) is basically used interchangeably with DFT.

Your spectrum analyzer likely uses FFT chips to analyze the input.

---

<div class="post-metadata">

### Author: ![Rhythmdvl](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rhythmdvl](https://boards.straightdope.com/u/Rhythmdvl)
#### Post date: [November 15, 2010, 9:29pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/14 "2010-11-15T21:29:37Z")

</div>

Thanks.

---

<div class="post-metadata">

### Author: ![Bosda\_Di\_Chi\_of\_Tricor](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bosda_di_chi_of_tricor/32/16845_2.png) [@Bosda\_Di\_Chi\_of\_Tricor](https://boards.straightdope.com/u/Bosda_Di_Chi_of_Tricor)
#### Post date: [November 15, 2010, 10:52pm UTC](https://boards.straightdope.com/t/how-does-shazam-work/560627/15 "2010-11-15T22:52:59Z")

</div>

> [@RealityChuck](#):
>
> Obviously, it works using the wisdom of Solomon, the strength of Hercules, the stamina of Atlas, the power of Zeus, the courage of Achilles, and the speed of Mercury.

Or Selena for grace, Hippolyta for strength, Athena for skill, Zephyrus for fleetness (and flight), Aphrodite for beauty, and Minerva for wisdom.

If you’re a girl.
