Archive for category web services

New Genre APIs

localhost_8000_index.html-2Today 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:

Sample output:

% 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:

  1. Simple Man by Lynyrd Skynyrd
  2. Born To Be Wild by Steppenwolf
  3. All Along The Watchtower by Jimi Hendrix
  4. Kashmir by Led Zeppelin
  5. Sunshine Of Your Love by Cream
  6. Let’s Work Together by Canned Heat
  7. Gimme Shelter by The Rolling Stones
  8. It’s My Life by The Animals
  9. 30 Days In The Hole by Humble Pie
  10. Midnight Rider by The Allman Brothers Band
  11. The Joker by Steve Miller Band
  12. Fortunate Son by Creedence Clearwater Revival
  13. Black Betty by Ram Jam
  14. Heart Full Of Soul by The Yardbirds
  15. Light My Fire by The Doors

The ‘in rotation’ classic rock playlist looks like this:

  1. Heaven on Earth by Boston
  2. Doom And Gloom by The Rolling Stones
  3. Little Black Submarines by The Black Keys
  4. I Gotsta Get Paid by ZZ Top
  5. Fly Like An Eagle by Steve Miller Band
  6. Blue On Black by Kenny Wayne Shepherd
  7. Driving Towards The Daylight by Joe Bonamassa
  8. When A Blind Man Cries by Deep Purple
  9. Over and Over (Live) by Joe Walsh
  10. The Best Is Yet To Come by Scorpions
  11. World Boss by Gov’t Mule
  12. One Way Out by The Allman Brothers Band
  13. Corned Beef City by Mark Knopfler
  14. Bleeding Heart by Jimi Hendrix
  15. My Sharona by The Knack

While the emerging ‘classic rock’ playlist looks like this:

  1.  If You Were in Love by Boston
  2.  Beggin’ by Shocking Blue
  3.  Speak Now by The Answer
  4.  Mystic Highway by John Fogerty
  5.  Hell Of A Season by The Black Keys
  6.  No Reward by Gov’t Mule
  7.  Pretty Wasted by Tito & Tarantula
  8.  The Battle Of Evermore by Page & Plant
  9.  I Got All You Need by Joe Bonamassa
  10.  What You Gonna Do About Me by Buddy Guy
  11.  I Used To Could by Mark Knopfler
  12. Wrecking Ball by Joe Walsh
  13. The Circle by Black Country Communion
  14. You Could Have Been a Lady by April Wine
  15. 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.

, , , ,

1 Comment

The Ultimate List of Music 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

music-api-logos-small

, ,

3 Comments

The Music Maze

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).

We’ve seen the idea behind the Music Maze in other apps like Musicovery and Tuneglue’s Music Map.  The nifty thing about the Music Maze is that I didn’t have to write a single line of server code to make it all happen.  The Music Maze web app talks directly to The Echo Nest API.   There’s no middle man.  The artist graph, the album art, the links to audio – everything are pulled on demand from the Echo Nest API.  This  is possible because the Echo Nest API now supports JSONP requests (in beta, full release coming soon!).  With JSONP  an AJAX app can escape the Javascript sandbox and make calls to 3rd party web services. No need for me to set up a server to proxy calls to the Echo Nest, no Apache or Tomcat, no MySQL,  no worries about scaling.  This makes it incredibly easy for me to host and deploy this app.  I just toss my HTML, Javascript and CSS files into an Amazon S3 bucket, make them world readable, and I’m done.  It really has never been easier to create Music Apps. This whole app is less than 500 lines of javascript, written in a few hours on a  Sunday morning while the rest of the family are still asleep.  It is great to see all of these technologies coming together to make easy to create music apps.

(Be sure to check out the JavaScript InfoVis Toolkit . It does all of the the graphical heavy lifting in this app. It’s pretty neat.)

18 Comments

What’s the TTKP?

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
between plays
Average time
to next play
Taio Cruz 84 1:07 0:34
Rihanna 80 1:27 0:44
Usher 79 1:20 0:40
Katy Perry 76 1:18 0:39
Bruno Mars 73 1:30 0:45
Nelly 56 1:44 0:52
Mike Posner 56 1:57 0:59
Pink 47 2:20 1:10
Lady Gaga 47 1:59 1:00
Taylor Swift 41 2:17 1:09

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.

, , , ,

2 Comments

The Echo Nest gets Personal

Duke University Archives

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.

4 Comments

testing one of the new APIs

nest% least_energy the beatles
0.08 Julia
0.09 Yesterday
0.11  Golden Slumbers
0.11 Blackbird  / Yesterday

nest% least_danceable the beatles
0.02 Revolution 9
0.07 Within You Without You _ Tomorrow Never Knows
0.07  Because

nest% most_energy led zeppelin
0.98 Moby Dick — Bonzo’s Montreux
0.98 Bonzo’s Montreux
0.95 Walter’s Walk
0.95 D’yer Mak’er

nest% most_danceable led zeppelin
0.73 Black Country Woman
0.64 Boogie With Stu
0.63 All My Love
0.63 The Rover

, , , ,

2 Comments

Some like it loud …

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[0].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):

Bedroom Acoustics by Muse

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.

Leave a comment

Follow

Get every new post delivered to your Inbox.

Join 1,094 other followers