Archive for category web services
Today at the Echo Nest we are pushing out an update to our Genre APIs. The new APIs lets you get all sorts of information about any of over 800 genres including a description of the genre, representative artists in the genre, similar genres, and links to web resources for the genre (such as a wikipedia page, if one exists for a genre). You can also use the genres to create various types of playlists. With these APIs you build all sorts of music exploration apps like Every Noise At Once, Music Popcorn and Genre-A-Day.
The new APIs are quite simple to use. Here are a few python examples created using pyen.
List all of the available genres with a description
This outputs text like so:
We can get the top artists for any genre like so:
Here are the top artists for ‘cool jazz’
We can find similar genres to any genre with this bit of code:
% python sim_genres.py cool jazz bebop jazz hard bop contemporary post-bop soul jazz big band jazz christmas stride jazz funk jazz fusion avant-garde jazz free jazz
We can use the genres to create excellent genre playlists. To do so, create a playlist of type ‘genre-radio’ and give the genre name as a seed. We’ve also added a new parameter called ‘genre_preset’ that, if specified will control the type of songs that will be added to the playlist. You can chose from core, in_rotation, and emerging. Core genre playlists are great for introducing a new listener to the genre. Here’s a bit of code that generates a core playlist for any genre:
The core classic rock playlist looks like this:
- Simple Man by Lynyrd Skynyrd
- Born To Be Wild by Steppenwolf
- All Along The Watchtower by Jimi Hendrix
- Kashmir by Led Zeppelin
- Sunshine Of Your Love by Cream
- Let’s Work Together by Canned Heat
- Gimme Shelter by The Rolling Stones
- It’s My Life by The Animals
- 30 Days In The Hole by Humble Pie
- Midnight Rider by The Allman Brothers Band
- The Joker by Steve Miller Band
- Fortunate Son by Creedence Clearwater Revival
- Black Betty by Ram Jam
- Heart Full Of Soul by The Yardbirds
- Light My Fire by The Doors
The ‘in rotation’ classic rock playlist looks like this:
- Heaven on Earth by Boston
- Doom And Gloom by The Rolling Stones
- Little Black Submarines by The Black Keys
- I Gotsta Get Paid by ZZ Top
- Fly Like An Eagle by Steve Miller Band
- Blue On Black by Kenny Wayne Shepherd
- Driving Towards The Daylight by Joe Bonamassa
- When A Blind Man Cries by Deep Purple
- Over and Over (Live) by Joe Walsh
- The Best Is Yet To Come by Scorpions
- World Boss by Gov’t Mule
- One Way Out by The Allman Brothers Band
- Corned Beef City by Mark Knopfler
- Bleeding Heart by Jimi Hendrix
- My Sharona by The Knack
While the emerging ‘classic rock’ playlist looks like this:
- If You Were in Love by Boston
- Beggin’ by Shocking Blue
- Speak Now by The Answer
- Mystic Highway by John Fogerty
- Hell Of A Season by The Black Keys
- No Reward by Gov’t Mule
- Pretty Wasted by Tito & Tarantula
- The Battle Of Evermore by Page & Plant
- I Got All You Need by Joe Bonamassa
- What You Gonna Do About Me by Buddy Guy
- I Used To Could by Mark Knopfler
- Wrecking Ball by Joe Walsh
- The Circle by Black Country Communion
- You Could Have Been a Lady by April Wine
- 15 Lonely by Walter Trout
The new Genre APIs are really quite fun to use. I’m looking forward to seeing a whole new world of music exploration and discovery apps built around these APIs.
I’ve started to build the ultimate list of music APIs. My goal for the list is for it to be a one-stop spot to find the best music apis. Currently 65 APIs are listed across 10 categories. Check out the list here: Music APIs
I wrote an application over the weekend called Music Maze. The Music Maze lets you wander through the maze of similar artists until you find something you like. You can give it a try here: The Music Maze (be forewarned, the app plays music upon loading).
Whenever Jennie and I are in the car together, we will listen to the local Top-40 radio station (KISS 108). One top-40 artist that i can recognize reliably is Katy Perry. It seems like we can’t drive very far before we are listening to Teenage Dreams, Firework or California Gurls. That got me wondering what the average Time To Katy Perry (TTKP) was on the station and how it compared to other radio stations. So I fired up my Python interpreter, wrote some code to pull the data from the fabulous YES api and answer this very important question. With the YES API I can get the timestamped song plays for a station for the last 7 days. I gathered this data from WXKS (Kiss 108), did some calculations to come up with this data:
- Total songs played per week: 1,336
- Total unique songs: 184
- Total unique artists: 107
- Average songs per hour: 7
- Number of Katy Perry plays: 76
- Median Time between Katy Perry songs: 1hour 18 minutes
That means the average Time to Katy Perry is about 39 minutes.
Katy Perry is only the fourth most played artist on KISS 108. Here are the stats for the top 10:
|Artist||Plays|| Median time
| Average time
to next play
I took a look at some of the other top-40 stations around the country to see which has the lowest TTKP:
|Station||Songs Per Hour||TTKP|
|KIIS – LA’s #1 hit music station||8||39 mins|
|WHTZ- New York’s #1 hit music station||9||48 mins|
|WXKS- Boston’s #1 hit music station||7||39 mins|
|WSTR- Atlanta – Always #1 for Today’s Hit Music||8||38 mins|
|KAMP- 97.1 Amp Radio – Los Angeles||11||38 mins|
|KCHZ- 95.7 – The Beat of Kansas City||11||32 mins|
|WFLZ- 93.3 – Tampa Bay’s Hit Music channe||9||39 mins|
|KREV- 92.7 – The Revolution – San Francisco||11||36 mins|
So, no matter where you are, if you have a radio, you can tune into the local top-40 radio station, and you’ll need to wait, on average, only about 40 minutes until a Katy Perry song comes on. Good to know.
Here at the Echo Nest just added a new feature to our APIs called Personal Catalogs. This feature lets you make all of the Echo Nest features work in your own world of music. With Personal Catalogs (PCs) you can define application or user specific catalogs (in terms of artists or songs) and then use these catalogs to drive the behavior of other Echo Nest APIs. PCs open the door to all sorts of custom apps built on the Echo Nest platform. Here are some examples:
Create better genius-style playlists – With PCs I can create a catalog that contains all of the songs in my iTunes collection. I can then use this catalog with the Echo Nest Playlist API to generate interesting playlists based upon my own personal collection. I can create a playlist of my favorite, most danceable songs for a party, or I can create a playlist of slow, low energy, jazz songs for late night reading music.
Create hyper-targeted recommendations - With PCs I can make a catalog of artists and then use the artist/similar APIs to generate recommendations within this catalog. For instance, I could create an artist catalog of all the bands that are playing this weekend in Boston and then create Music Hack Day recommender that tells each visitor to Boston what bands they should see in Boston based upon their musical tastes.
Get info on lots of stuff – people often ask questions about their whole music collection. Like, ‘what are all the songs that I have that are at 113 BPM?‘, or ‘what are the softest songs?’ Previously, to answer these sorts of questions, you’d have to query our APIs one song at a time – a rather tedious and potentially lengthy operation (if you had, say, 10K tracks). With PCs, you can make a single catalog for all of your tracks and then make bulk queries against this catalog. Once you’ve created the catalog, it is very quick to read back all the tempos in your collection.
Represent your music taste – since a Personal Catalog can contain info such as playcounts, skips, and ratings for all of the artists and songs in your collection, it can serve as an excellent proxy to your music taste. Current and soon to be released APIs will use personal catalogs as a representation of your taste to give you personalized results. Playlisting, artist similarity, music recommendations all personalized based on you listening history.
These examples just scratch the surface. We hope to see lots of novel applications of Personal Catalogs. Check out the APIs, and start writing some code.
One of the nifty features that we’ve rolled out in the last 6 months here at the Echo Nest is an extremely flexible song search API. With this API you can search for songs based upon all sorts of criteria from tempo, key mode, duration. You can use this API to do things that would be really hard to do. For example, here’s a bit of python that will show you the loudest songs for an artist:
from pyechonest import song as songAPI from pyechonest import artist as artistAPI def find_loudest_songs(artist_name): artists = artistAPI.search(artist_name, results=1) if artists: songs = songAPI.search(artist_id=artists.id, sort='loudness-desc') for song in songs: print song.get_audio_summary().loudness, song.title
Here are the loudest songs for some sample artists:
- The Beatles: Helter Skelter, Sgt Peppers Lonely Hearts Club Band
- Metallica: Cyanide, All Nightmare Long
- The White Stripes: Broken Bricks, Fell in love with a girl
- Led Zeppelin: Rock and Roll, Black Dog
We can easily change the code to help us find the softest songs for an artist, or the fastest, or the shortest. Some more examples:
- Shortest Beatles song: Her Majesty at 23.2 second
- Longest Beatles song: Revolution #9 at 8:35
- Slowest Beatles song: Julia at 57 BPMs
- Softest Beatles song: Julia at -27DB BPMs (Blackbird is at -25DB)
I think it is interesting to find the outliers. For instance, here’s the softest song by Muse (which is usually a very loud artist):
We can combine these attributes too so we can find the fastest loud Beatles song (I feel fine, at -7.5 DB and 180 BPM, or the slowest loud Beatles song (Don’t let me down, at -6.6 DB and 65 BPM).
The search songs api is a good example of the power of the Echo Nest platform. We have data on millions of songs that you can use to answer questions about music that have traditionally been very hard to answer.
For my London Music Hackday hack I built a web app called ‘Earth Destroyers’. Give Earth Destroyers a band name and it will show you how eco-friendly the band’s touring schedule is. Earth Destroyers calculates the total distance traveled from the first gig to the last along with the average distance between shows. If an artist has an average inter-show distance of greater than a 1,000 km I consider it an ‘Earth Destroyer’. The app also shows you a Google map so you can see just how inefficient the tour is. To build the app I used event data from Bandsintown.
Check out Earth Destroyers
Yesterday, Steve Jobs reminded us that it was less than 10 years ago when Apple announced the first iPod which could put a thousand songs in your pocket. With the emergence of cloud-based music services like Spotify and Rhapsody, we can now have a virtually endless supply of music in our pocket. The ‘bottomless iPod’ will have as big an effect on how we listen to music as the original iPod had back in 2001. But with millions of songs to chose from, we will need help finding music that we want to hear. Shuffle play won’t work when we have a million songs to chose from. We will need new tools that help us manage our listening experience. I’m convinced that one of these tools will be intelligent automatic playlisting.
This weekend at the Music Hack Day London, The Echo Nest is releasing the first version of our new Playlisting API. The Playlisting API lets developers construct playlists based on a flexible set of artist/song selection and sorting rules. The Echo Nest has deep data about millions of artists and songs. We know how popular Lady Gaga is, we know the tempo of every one of her songs, we know other artists that sound similar to her, we know where she’s from, we know what words people use to describe her music (‘dance pop’, ‘club’, ‘party music’, ‘female’, ‘diva’ ). With the Playlisting API we can use this data to select music and arrange it in all sorts of flexible ways – from very simple Pandora radio style playlists of similar sounding songs to elaborate playlists drawing on a wide range of parameters. Here are some examples of the types of playlists you can construct with the API:
- Similar artist radio – generate a playlist of songs by similar artists
- Jogging playlist – generate a playlist of 80s power pop with a tempo between 120 and 130 BPM, but never ever play Bon Jovi
- London Music Hack Day Playlist -generate a playlist of electronic and techno music by unknown artists near London, order the tracks by tempo from slow to fast
- Tomorrow’s top 40 – play the hottest songs by pop artists with low familiarity that are starting to get hottt
- Heavy Metal Radio – A DMCA-Compliant radio stream of nothing but heavy metal
We have also provide a dynamic playlisting API that will allow for the creation of playlists that adapt based upon skipping and rating behavior of the listener.
I’m about to jump on a plane for the Music Hackday London where we will be demonstrating this new API and some cool apps that have already been built upon it. I’m hoping to see a few apps emerge from this Music Hack Day that use the new API. More info about the APIs and how you can use it to do all sorts of fun things will be forthcoming. For the motivated dive into the APIs right now.
TL;DR; I built a game called Name Dropper that tests your knowledge of music artists.
One bit of data that we provide via our web APIs is Artist Familiarity. This is a number between 0 and 1 that indicates how likely it is that someone has heard of that artists. There’s no absolute right answer of course – who can really tell if Lady Gaga is more well known than Barbara Streisand or whether Elvis is more well known than Madonna. But we can certainly say that The Beatles are more well known, in general, than Justin Bieber.
To make sure our familiarity scores are good, we have a Q/A process where a person knowledgeable in music ranks our familiarity score by scanning through a list of artists ordered in descending familiarity until they start finding artists that they don’t recognize. The further they get into the list, the better the list is. We can use this scoring technique to rank multiple different familiarity algorithms quickly and accurately.
One thing I noticed, is that not only could we tell how good our familiarity score was with this technique, this also gives a good indication of how well the tester knows music. The further a tester gets into a list before they can’t recognize artists, the more they tend to know about music. This insight led me to create a new game: The Name Dropper.
The Name Dropper is a simple game. You are presented with a list of dozen artist names. One name is a fake, the rest are real.
If you find the fake, you go onto the next round, but if you get fooled, the game is over. At first, it is pretty easy to spot the fakes, but each round gets a little harder, and sooner or later you’ll reach the point where you are not sure, and you’ll have to guess. I think a person’s score is fairly representative of how broad their knowledge of music artists are.
The biggest technical challenge in building the application was coming up with a credible fake artist name generator. I could have used Brian’s list of fake names – but it was more fun trying to build one myself. I think it works pretty well. I really can’t share how it works since that could give folks a hint as to what a fake name might look like and skew scores (I’m sure it helps boost my own scores by a few points). The really nifty thing about this game is it is a game-with-a-purpose. With this game I can collect all sorts of data about artist familiarity and use the data to help improve our algorithms.
So go ahead, give the Name Dropper a try and see if you can push me out of the top spot on the leaderboard: