Wednesday, September 5, 2012

Experimenting with the EchoNest API

I've finally made it to a Boston Python User Group meeting - Sept Project Night! For my project tonight, I decided to experiment with the Echo Nest API, including the Echo Nest Remix API. If you're interested in following along, here are some steps:

  1. Make sure you have Python installed. If you want to play with the Echo Nest Remix API, it currently requires Python 2.6.
  2. Don't forget that you will also need setuptools to install Python packages.
  3. Get an API key from The Echo Nest. I'm on Windows, and I also set up an environment variable, ECHO_NEST_API_KEY, with my API key.
  4. There is a Python wrapper for the Echo Nest API. Get it from Github and install it using python setup.py install.
  5. Install the native installer for The Echo Nest Remix API from Google Code.
  6. Have fun!
Tonight, I haven't done anything earth shattering with the API. Here is some sample code that uses just the Echo Nest API (not the Remix API), which is pretty similar to the examples you'll find on The Echo Nest's pages:

from pyechonest import config, artist

config.ECHO_NEST_API_KEY="YOUR API KEY"

bk = artist.Artist('boney m')
print "Artists similar to: %s:" % (bk.name,)
for similar_artist in bk.similar:
    print "\t%s" % (similar_artist.name,)
   
from pyechonest import artist
for hottt_artist in artist.top_hottt():
   print hottt_artist.name, hottt_artist.hotttnesss



No comments:

Post a Comment