Posts Tagged playlists

Artist radio in 10 lines of code

Last week we released Pyechonest, a Python library for the Echo Nest API.  Pyechonest gives the Python programmer access to the entire Echo Nest API including artist and track level methods.  Now after 9 years working at Sun Microsystems, I am a diehard Java programmer, but I must say that I really enjoy the nimbleness and expressiveness of Python.  It’s fun to write little Python programs that do the exact same thing as big Java programs.  For example, I wrote an artist radio program in Python that, given a seed artist, generates a playlist of tracks by wandering around the artists in the neighborhood of the seed artists and gathering audio tracks.   With Pyechonest, the core logic is 10 lines of code:

def wander(band, max=10):
   played = []
   while max:
     if band.audio():
         audio = random.choice(band.audio())
         if audio['url'] not in played:
             play(audio)
             played.append(audio['url'])
             max -= 1
     band = random.choice(band.similar())

(You can see/grab the full code with all the boiler plate in the SVN repository)

This method takes a seed artist (band) and selects a random track from set of audio that The Echo Nest has found on the web for that artist, and if we haven’t already played it, then do so. Then we select a near neighbor to the seed artist and do it all again until we’ve  played the desired number of songs.

For such a simple bit of code, the playlists generated are surprisingly good..Here are a few examples:

Seed Artist:  Led Zeppelin:

(I think the Dale Hawkins version of Susie-Q after  CCR’s Fortunate Son  is just brilliant)

Seed Artist: The Decemberists:

(Note that audio for these examples is audio found on the web – and just like anything on the web the audio could go away at any time)

I think these artist-radio style playlists rival just about anything you can find on current Internet radio sites – which ain’t to0 bad for 10 lines of code.

, , , , , ,

9 Comments

The Beat that follows your feet

There’s a new application in the Echo Nest developer showcase called SynchStep.  SynchStep is an iPhone/iTouch application (currently only for jailbroken devices) that automatically synchronizes the music to your walking or running pace.   SynchStep uses the Echo Nest Analyze API to extract the tempo for each song in your collection and when you are out for a walk or a run it will pick a song that matches your tempo.

I’ve seen a few academic systems that do this sort of thing.  For instance, at last year’s ISMIR there was a paper called  Development of an automatic music selection system based on runner’s step frequency that described a similar system. But SynchStep is the first system I’ve seen that is available to the general public  on a popular platform like the iPhone.

SynchStep is a great example of a context-sensitive playlister.   Instead of a list of songs selected via a random number generator, or via  a DJ sitting in some dark, smoke-filled sound booth you get a playlist that matches what you are doing.  I think we are going to see more attention paid to context-sensitive playlists:  ‘Music for the root canal’, ‘Music that synchronizes with my windshield wipers’,  ‘music for that first date with that girl who you think may be kind of emo’, and so on.    To make these kind of playlists, the playlist generators will have to know what you are doing, and they’ll have to know what the music sounds like.  Platforms like the iPhone already provides lots of context – the iPhone knows where you are,  what time it is, it can hear you, it can see you, it can feel you move,  it knows that the emo girl just sent you a  ‘dear john’ IM,  it can even hear your heartbeat.     Signal processing and music analysis provides the other piece of the puzzle – knowing what the music sounds like.   Just like SynchStep picks a track with a tempo that matches your pace, these next generation, context-aware playlisters will select music that fits the context.   So when that kind-of-emo girl dumps you, your iPhone will know about it and will try to cheer you up with a little Katrina & The Waves.  This song has super powers,  it can even make the emo boys happy.

, , ,

2 Comments