for years i’ve been trying to hijack music recognition services like shahzam to be able to recognize music. i’ve finally got this working thanks to the fine guys at echonest, who kindly provide a proper api for this. my proof of concept is running on a spare macbook.
here’s how it works on the mac atm:
1. the os x automator runs in a 90 second loop, recording audio with quicktime and then running a cli php script.
2. the php script first converts the recorded .mov file to .mp3 with ffmpeg/lame
3. the php script then runs the echonest binary for music fingerprinting, which generates a json string
4. part of the json string is sent via curl to the echonest service and (hopefully) resolved
5. echonest returns artist, title and a unique id. this id is saved i a recent-log so that the php script can skip a run if it runs 2 times during the same song
6. artist and title are curled back to our lamp-server, where we save all plays in a database (mongodb atm)
7. artist and title can then be sent to any service you wish to interact with
making this projekt was pretty straight forward, except for a minor obstacle which took me a few hours to figure out. it turns out that the echonest binary calls ffmpeg internally, and for some reason automator couldn’t find ffmpeg in it’s $PATH. when i realized this the fix was done in a second, i just needed to make a symlink from the $PATH automator used to where i had ffmpeg locally.
next step: will try this a few days and see how well it performs. if it’s good enough i’ll buy a tiny linux box and give it a pair of rca jacks.
links:
the earth people account on last.fm which we scrobble vinyl to atm
the awesome echonest service