NIEDZIELSKI.COM
 

bananas

I finally got around to experimenting with the last.fm / Audioscrobbler API to generate song recommendations.  It turned out to be fairly simple to write a rudimentary Python script to automate the task.  For example, here’s all the code for retrieving data in XML form from last.fm:

import urllib

def service( str_url ):
sock = urllib.urlopen( str_url )
str_xml = sock.read()
sock.close()
return str_xml

The script is fairly pragmatic / specific / hackish. I just wanted my recommendations. Here’s a breakdown of the automation:

  1. Get my top 50 tracks.
  2. For each track, get the top 50 listeners.
  3. For each listener, get their top 50 tracks.
  4. Count the number of occurrences of each track and dump the results in an ordered list.

In terms of results, here are my top ten recommendations (without tracks already contained in my top 10):

0080: Coldplay – Viva la Vida
0070: The Killers – When You Were Young
0066: Paramore – Misery Business
0050: Metro Station – Shake It
0049: The Postal Service – Such Great Heights
0047: Coldplay – Violet Hill
0046: Muse – Starlight
0046: Death Cab for Cutie – I Will Follow You Into the Dark
0043: Jason Mraz – I’m Yours
0041: Death Cab for Cutie – Soul Meets Body

The numbered column on the left represents the number of listener top 50’s a song was found in during the search. The second column represents song artist. The third represents song title.

So I listened to the recommendations! Out of the above 10, there was one song I enjoy (Starlight, for the record) and the rest didn’t do anything for me. BAH! I think that in order to get better results I would need to make a significantly more sophisticated selection.

At any rate. you may download my hackjob here.

last.fm

  last.fm now has a database of over 10 000 tracks I have listened to. Yet it makes horrible recommendations for new music I might enjoy. Here are some notable problems I’ve pondered:

  1.   Recommendations seem to be based on the granularity of artist. This doesn’t work well at all for me. Often I only enjoy a single song on an entire album or even an entire artist’s corpus.
  2.   I don’t have a solution for this next problem. Often, because I enjoy a song so much, I keep replaying it. But if I’m multitasking, I may lose focus and a song or two beyond this favored track will play. This may give an unintended boost to particular tracks.
  3.   Better track spying. It would be great if last.fm kept track of not just what songs I played, but the portion of the song I listened to as well. This comes into effect with hidden tracks particularly.
  4.   Nothing to do with recommendations, but the web radio player captures my Firefox keyboard shortcuts preventing me from opening new tabs (ctrl t) or alternating tabs (ctrl tab).