Posts Tagged mixtape

My new superpower – creating Spotify playlists from a web app

labs_echonest_com_CityServer_callback_html_access_token_BQBcbPg0FicOcTQ2Epc5XxGkMNuQPU4LA-ou9LP0lo7qx-4FNd7QlJNXtXziRF04gPtbATfmh9Xe25vJeUVrOQLOrhpQi4La3jT6dEUc7XHD_7iB9oStWBN9PuNGoWB_WKg8goz92CQpYHVM50z_wjY_token_type_Bearer_expires_in_360The new Spotify Web API allows the developer to create and add tracks to a playlist on behalf of a listener. This is a pretty powerful feature, opening the door for a whole range of apps. For instance, this weekend, I added the ability to save a Roadtrip Mixtape playlist, so you can now actually take your mixtapes on the road.   The code is on github if  you are interested in seeing how it is done.

 

, , ,

7 Comments

Roadtrip Mixtape

Over the last few years I’ve made a number of 1,000+ mile road trips as I shuttle kids to colleges in far away places. Listening to music has always been a big part of these trips.  I thought it’d be nice to be able to listen to music by local artists when driving through a particular region, so I spent a few weekends creating an app called Roadtrip Mixtape that populates a roadtrip playlist with artists that are from the region you are driving through.

To create a playlist, type your starting and ending cities for your roadtrip.  The app will use Google’s directions to plan the best route between the two cities.  The route will then be broken into 15 minute playlist legs. Each playlist leg is populated by 15 minutes worth of music by nearby artists.

The beginning of each leg is represented by a green ball. You can click on the ball to see what artists will be played during that leg.  The app plays music via Rdio using their nifty Web  Player API.  If you are an Rdio subscriber you can listen to full streams, and if not you get to hear 30 second samples.  One bit of interesting info that I show for a route is the ‘Avg distance’.  This shows the average distance to each artist on the roadtrip. If this number is low, you are traveling through a musically dense part of the world, and if it is high,  you are traveling in a sparse musical region. For instance, for a roadtrip from Boston to New York the average artist distance is 3 miles (about as low as it goes).   However, if you are traveling from Omaha to Denver, the average artist distance is 81 miles.

You can also click anywhere on the map to see and listen to nearby artists.   For example, if you click on Shreveport you’ll see something like this:

When you click the ‘Hear here’ button, you’ll get a playlist of the hotttest artists from Shreveport.

Listening to nearby artists is quite fun. There’s potential from some extreme sonic whiplash as you drive near a brutal death metal band and then a pop vocalist from the 1950s

The Technical Bits
To build the app I used the new artist location data from The Echo Nest.  This (still in beta) feature, allows you to retrieve the location of any artist.  Here’s an example API call that retrieves the artist location for Radiohead:

http://developer.echonest.com/api/v4/artist/profile?api_key=N6E4NIOVYMTHNDM8J&name=radiohead&format=json&bucket=artist_location

For this app, I collected the locations for the top 100,000 or so most popular artists in the Rdio catalog.  These artists were from about 15,000 different cities.  I used geopy along with the Yahoo Placefinder geocoder to find the latitude and longitude for each of these cities.  For the mapping and route finding, I used version 3.9 of the Google maps API.   For music playback I used the Rdio Web Playback API.   With the tight integration between the Echo Nest and Rdio ID spaces it was easy to go from a geolocated Echo Nest artist to a list of Rdio track IDs for songs by that artist.

The Bad Bits
As a web app that relies on the flash-based Rdio web player,  Roadtrip Mixtape  is not really a mobile app.  It won’t play music on an iPhone or iPad, so the best way to actually use this app on the road is probably to bring along your tethered laptop.  Not the best user experience.  Thus, my next weekend project will be to learn a little bit of iOS programming a make a version of this app that runs on an iPhone and an iPad.  Stay tuned for the next version.

, , , ,

2 Comments

Follow

Get every new post delivered to your Inbox.

Join 987 other followers