Tuesday, February 18, 2014

SoundCloud Track Finder

Let me give you some background. The majority of my material used in my DJ sets is purchased on Beatport. As a Bedroom DJ or music enthusiast, this can quickly turn into a very expensive hobby. Sure there are music pools I could join. Yet music pools can be sketchy or simply doesn't have what I'm looking for. What I never recommend is torrenting or unauthorized downloading. It really hurts the artists who make such great music and make a living and use it to put bread on the table and pay rent. Luckily, there are many artists and labels that provide free tracks for us to discover and enjoy. Enter SoundCloud where are artist provide free music, free as in gratis, not libre (although you could search for creative commons material too). SoundCloud has become very popular with it's easy discovery, sharing, and music playback. Despite SoundCloud's fantastic interface discovering new samples and material can still be very time consuming. Thankfully, SoundCloud has an application programming interface (API). I decided one Sunday with encouragement and support from my girlfriend to fire up my Ubuntu virtual machine and write some code. It took me a while, but it turned out to be a great learning exercise for Python. Something I've been meaning to do for years. While it's simple, and a long way from being finished. Eventually, I plan on making a full working web interface with drop down menus and an integrated player. Here's what I have so far. Feel free to drop a comment for any questions on actually getting this to work or interests in it's further development. Here's a screen shot.

Sample Code explained:

1) Logins into SoundCloud with a Developer app Credentials (I removed my login information for security purposes, feel free to register for your own credentials)
2) Display who is logged in as.
3) Search:

  • Genre: Ambient
  • Return 50 Results
  • Track is set to Downloadable (Determined by artist)
  • Tracks between 3-10 minutes (In order to eliminate DJ sets, podcasts, and previews)
  • Playback Over 250 in order to find popular tracks worth listening to.
4) Catch any errors and move on 
5) Display the Results