Here is a good write-up on how it works:
https://github.com/jvbalen/soundofshazam/blob/master/sound_o...
And an example output (try Shazam-ing it!):
He also got some legal threats just for publishing code he created himself.
[0] http://royvanrijn.com/blog/2010/06/creating-shazam-in-java/