Archive for category code
Using The Echo Nest to get the top 100 Twitter artists
This week Twitter and The Echo Nest announced a partnership where Twitter IDs for verified accounts are incorporated into The Echo Nest’s ID mapping layer (aka Rosetta Stone). This makes it easy for developers to get the Twitter handle for an artist. To demonstrate just how easy it is, I wrote a little web app that displays the top 100 artists that have verified Twitter accounts. Here’s the core bit of code for the app:
function fetchTopTwitterArtists() {
var url = 'http://developer.echonest.com/api/v4/artist/top_hottt?callback=?';
$.getJSON(url, { 'api_key': 'GETYOUROWNAPIKEY', 'format':'jsonp',
'results': 100, 'bucket': ['hotttnesss', 'id:twitter'], 'limit': true},
function(data) {
for (var i = 0; i < data.response.artists.length; i++) {
var artist = data.response.artists[i];
var elem = $("<li>");
var link = $("<a>");
var handle = artist.foreign_ids[0].foreign_id.replace('twitter:artist:', '');
link.attr('href', 'http://twitter.com/' + handle);
link.text(artist.name);
elem.append(link);
$("#results").append(elem);
}
}
});
}
The key bits here are creating the artist/top_hottt request to The Echo Nest and adding the id:twitter bucket and setting limit to true. This tells the Echo Nest to include the twitter handle information in the results and limit the results to only those artists that have twitter information. After that it is just pulling the data out of the results and formatting it for the lovely display. The Twitter ID info is returned in an ID block that looks like this:
{"catalog": "twitter","foreign_id": "twitter:artist:LMFAO"}
Note that the Twitter ID is returned in a URN form. To get the actual Twitter URL for an artist we just need to replace the ‘twitter:artist:’ bits with ‘http://twitter.com/’.
You can see the app here: Top 100 artists with verified Twitter accounts. As you can see, I tried to make the web app as ugly as possible. The only thing it needs is some Comic Sansification. The code is available for detailed study in this gist.
Have artist names been getting longer?
Posted by Paul in code, data, Music, The Echo Nest on January 7, 2012
On Quora, someone asked the question: Are band names getting longer? To answer that question I used the Echo Nest API to get the top 500 artists for each five year window starting in 1950 and calculated the average name length for each of the artists.
The answer to the question as to whether artist names have been getting longer is a surprising No. The average length of artist names peaked in the period from 1955-1959. This was the age when bands were called ‘XX and the YY’ like Van McCoy & The Soul City Symphony and Herb Alpert & The Tijuana Brass. Surprisingly, the era of the shortest names is 1990-1994 . The bands “… And you will know us by the trail of the dead” (1994) and “The Presidents of the United States of America” (1993) were really bucking the trend.
And the longest name, and my favorite is 2010’s Tim and Sam’s Tim and the Sam Band with Tim and Sam .
Here’s a chart showing the mean and maximum length over the years.
Overall Longest Names
Here are the longest artist names and their start year:
- 51 2010 Tim and Sam’s Tim and the Sam Band with Tim and Sam
- 48 1994 …And You Will Know Us By The Trail Of The Dead
- 47 1967 Charles Wright & The Watts 103rd St Rhythm Band
- 46 1993 The Presidents of the United States of America
- 44 1959 Van McCoy & The Soul City Symphony Orchestra
- 43 2000 Richard Cheese & Lounge Against The Machine
- 43 1950 Benedictine Monks of Santo Domingo de Silos
- 41 1981 Emir Kusturica & The No Smoking Orchestra
- 39 1972 Afrika Bambaataa & The Soul Sonic Force
- 37 2010 Antoine Dodson & The Gregory Brothers
- 37 2005 Edward Sharpe and the Magnetic Zeroes
- 37 1999 Someone Still Loves You Boris Yeltsin
- 36 1977 Gloria Estefan & Miami Sound Machine
- 36 1970 Jonathan Richman & The Modern Lovers
- 36 1964 Captain Beefheart and his Magic Band
- 35 2010 RPA and the United Nations of Sound
- 35 2005 Edward Sharpe & The Magnetic Zeroes
- 35 1975 Johnny Thunders & The Heartbreakers
- 35 1959 Academy of St. Martin in the Fields
- 34 2010 Noel Gallagher’s High Flying Birds
- 34 1978 Deutsch Amerikanische Freundschaft
- 34 1959 Van McCoy & The Soul City Symphony
- 33 2010 RPA & The United Nations Of Sound
- 33 1995 Robbie Williams And Jane Horrocks
- 33 1978 Orchestral Manoeuvres in the Dark
- 33 1974 George Thorogood & The Destroyers
- 33 1965 Big Brother & The Holding Company
- 33 1957 Cliff Bennett & The Rebel Rousers
- 33 1955 The Clancy Brothers & Tommy Makem
- 32 2010 The Ghost Of A Saber Tooth Tiger
- 32 2007 The Pains of Being Pure at Heart
- 32 2005 Margot & the Nuclear So and So’s
- 32 1990 Emily Haines & The Soft Skeleton
- 32 1967 Kenny Rogers & The First Edition
- 32 1962 Mitch Ryder & The Detroit Wheels
- 32 1961 Patti LaBelle & Michael McDonald
- 32 1960 Frankie Valli & The Four Seasons
- 32 1960 Astor Piazzolla & Kronos Quartet
- 32 1959 Maurice Williams and The Zodiacs
- 32 1954 The Sensational Alex Harvey Band
- 31 1992 Jools Holland And Stereophonics
- 31 1990 Armand van Helden’s Sampleslaya
- 31 1977 Erste Allgemeine Verunsicherung
- 31 1976 Tom Petty and The Heartbreakers
- 31 1966 Nancy Sinatra And Lee Hazlewood
- 31 1964 Björn Ulvaeus & Benny Andersson
- 31 1963 The Paul Butterfield Blues Band
- 31 1963 John Mayall & The Bluesbreakers
- 31 1962 Martha Reeves and the Vandellas
- 31 1957 Herb Alpert & The Tijuana Brass
- 31 1950 Frank Zappa & Captain Beefheart
Longest Names by Year
1950 – 1954
Longest Names
- 43 Benedictine Monks of Santo Domingo de Silos
- 32 The Sensational Alex Harvey Band
- 31 Frank Zappa & Captain Beefheart
- 30 Harold Melvin & The Blue Notes
- 28 The Dutch Swing College Band
- 28 Le Mystère des voix Bulgares
- 28 James Carter & The Prisoners
- 27 Master Musicians of Jajouka
- 26 Los Guaracheros de Oriente
- 26 Los Corraleros De Majagual
- 24 The Dave Brubeck Quartet
- 24 The Charlie Daniels Band
- 24 Lee Andrews & The Hearts
- 24 Gladys Knight & The Pips
- 24 Dutch Swing College Band
- 23 Vieja Trova Santiaguera
- 23 The Oscar Peterson Trio
- 23 Johnny & The Hurricanes
- 22 The Sweet Inspirations
1955 – 1959
Longest Names
- 44 Van McCoy & The Soul City Symphony Orchestra
- 35 Academy of St. Martin in the Fields
- 34 Van McCoy & The Soul City Symphony
- 33 The Clancy Brothers & Tommy Makem
- 33 Cliff Bennett & The Rebel Rousers
- 32 Maurice Williams and The Zodiacs
- 31 Herb Alpert & The Tijuana Brass
- 30 Van Mccoy & the Soul City Symp
- 30 Smokey Robinson & The Miracles
- 30 Little Anthony & The Imperials
- 29 Van Morrison & The Chieftains
- 29 Nelson Riddle & His Orchestra
- 29 George Clinton and Parliament
- 29 Frankie Lymon & The Teenagers
- 29 Clancy Brothers & Tommy Makem
- 28 John Fred & His Playboy Band
- 27 Rocio Durcal & Juan Gabriel
- 27 Paul Revere and The Raiders
- 27 Cliff Richard & The Shadows
- 27 Byron Lee & The Dragonaires
1960 – 1964
Longest Names
- 36 Captain Beefheart and his Magic Band
- 32 Patti LaBelle & Michael McDonald
- 32 Mitch Ryder & The Detroit Wheels
- 32 Frankie Valli & The Four Seasons
- 32 Astor Piazzolla & Kronos Quartet
- 31 The Paul Butterfield Blues Band
- 31 Martha Reeves and the Vandellas
- 31 John Mayall & The Bluesbreakers
- 31 Björn Ulvaeus & Benny Andersson
- 29 Sam The Sham And The Pharaohs
- 29 Quicksilver Messenger Serv…
- 29 Nancy Sinatra & Lee Hazlewood
- 29 Martha Reeves & The Vandellas
- 29 La Arrolladora Banda El Limón
- 29 Billy J. Kramer & The Dakotas
- 28 Joe Cocker & Jennifer Warnes
- 28 El Gran Combo de Puerto Rico
- 27 Tommy James & The Shondells
- 27 Sam the Sham & The Pharaohs
- 27 Eric Burdon and the Animals
1965 – 1969
Longest Names
- 47 The Nitty Gritty Dirt Band & Kris Kristofferson
- 47 Charles Wright & The Watts 103rd St Rhythm Band
- 33 Big Brother & The Holding Company
- 32 Kenny Rogers & The First Edition
- 31 Nancy Sinatra And Lee Hazlewood
- 29 Quicksilver Messenger Service
- 29 New Riders of the Purple Sage
- 28 The United States of America
- 28 Gary Puckett & The Union Gap
- 28 Crosby, Stills, Nash & Young
- 28 Creedence Clearwater Revival
- 27 The Flying Burrito Brothers
- 26 The Nitty Gritty Dirt Band
- 26 The Incredible String Band
- 24 The Chocolate Watch Band
- 24 The Allman Brothers Band
- 24 The 13th Floor Elevators
- 24 Country Joe and the Fish
- 23 Van der Graaf Generator
1970 – 1974
Longest Names
- 39 Afrika Bambaataa & The Soul Sonic Force
- 36 Jonathan Richman & The Modern Lovers
- 33 George Thorogood & The Destroyers
- 30 Hamilton, Joe Frank & Reynolds
- 30 Grandmaster Flash & The Furiou
- 30 Elvis Costello & The Imposters
- 29 The Ozark Mountain Daredevils
- 29 England Dan & John Ford Coley
- 28 The Love Unlimited Orchestra
- 28 Steve Harley & Cockney Rebel
- 25 The Fabulous Thunderbirds
- 25 Premiata Forneria Marconi
- 25 Manfred Mann’s Earth Band
- 24 The Marshall Tucker Band
- 24 Love Unlimited Orchestra
- 24 Kenny G & Lenny Williams
- 24 KC and The Sunshine Band
- 24 Electric Light Orchestra
- 24 Bachman-Turner Overdrive
1975 – 1979
Longest Names
- 36 Gloria Estefan & Miami Sound Machine
- 35 Johnny Thunders & The Heartbreakers
- 34 Deutsch Amerikanische Freundschaft
- 33 Orchestral Manoeuvres in the Dark
- 31 Tom Petty and The Heartbreakers
- 31 Erste Allgemeine Verunsicherung
- 27 Richard Hell & The Voidoids
- 27 Ian Dury and the Blockheads
- 26 Marius Müller-Westernhagen
- 25 Siouxsie and the Banshees
- 24 The Alan Parsons Project
- 24 Television Personalities
- 24 Kenny “Babyface” Edmonds
- 23 Prince & The Revolution
- 23 Os Paralamas do Sucesso
- 23 Evelyn “Champagne” King
- 22 Yellow Magic Orchestra
- 22 Michael Schenker Group
- 22 Martha and the Muffins
- 22 Leevi and the Leavings
1980 – 1984
Longest Names
- 41 Emir Kusturica & The No Smoking Orchestra
- 29 Lloyd Cole and the Commotions
- 27 The Mighty Mighty Bosstones
- 27 Lloyd cole & the commotions
- 25 Nick Cave & The Bad Seeds
- 25 Frankie Goes to Hollywood
- 25 Fantastic Plastic Machine
- 25 Bruce Hornsby & The Range
- 24 The Jesus and Mary Chain
- 23 The Legendary Pink Dots
- 23 Juan Luis Guerra y 4.40
- 23 Everything but the Girl
- 23 Corrosion of Conformity
- 22 Fields of the Nephilim
- 22 Einstürzende Neubauten
- 21 Red Hot Chili Peppers
- 21 New Kids on the Block
- 21 Katrina and the Waves
- 20 They Might Be Giants
- 20 The Vaughan Brothers
1985 – 1989
Longest Names
- 29 Béla Fleck and The Flecktones
- 26 The Future Sound of London
- 25 Los Auténticos Decadentes
- 24 The James Taylor Quartet
- 23 Los Fabulosos Cadillacs
- 23 Boogie Down Productions
- 22 Manic Street Preachers
- 22 Die Fantastischen Vier
- 21 Toad the Wet Sprocket
- 21 The Smashing Pumpkins
- 21 The Innocence Mission
- 21 The Brand New Heavies
- 21 Steven Curtis Chapman
- 21 Mary Chapin Carpenter
- 21 Hootie & the Blowfish
- 21 Engenheiros do Hawaii
- 21 Donavon Frankenreiter
- 21 Compton’s Most Wanted
- 20 Terence Trent D’Arby
- 20 Switchblade Symphony
1990 – 1994
Longest Names
- 48 …And You Will Know Us By The Trail Of The Dead
- 46 The Presidents of the United States of America
- 32 Emily Haines & The Soft Skeleton
- 31 Jools Holland And Stereophonics
- 31 Armand van Helden’s Sampleslaya
- 28 The Brian Jonestown Massacre
- 27 Godspeed You! Black Emperor
- 26 Chester Charles Bennington
- 25 Del tha Funkee Homosapien
- 24 Trans-Siberian Orchestra
- 24 Sixpence None the Richer
- 24 Rage Against the Machine
- 23 Pete Rock & C.L. Smooth
- 23 Medeski Martin and Wood
- 23 John Michael Montgomery
- 23 G. Love & Special Sauce
- 22 Harry Gregson-Williams
- 22 Bonnie “Prince” Billie
- 21 The Chemical Brothers
1995 – 1999
Longest Names
- 38 Jessica Simpson duet with Marc Anthony
- 37 Someone Still Loves You Boris Yeltsin
- 33 Robbie Williams And Jane Horrocks
- 29 Someone Still Loves You Boris
- 29 Me First and the Gimme Gimmes
- 28 Handsome Boy Modeling School
- 27 Ted Leo and The Pharmacists
- 27 Black Rebel Motorcycle Club
- 25 The Dillinger Escape Plan
- 25 Supreme Beings of Leisure
- 24 The All-American Rejects
- 24 Mindless Self Indulgence
- 24 Damian “Jr. Gong” Marley
- 23 The Cinematic Orchestra
- 23 The American Analog Set
- 23 Queens of the Stone Age
- 23 Flight of the Conchords
- 23 DaRude Vs Zombie Nation
- 23 Bullet for My Valentine
- 23 Buena Vista Social Club
2000 – 2004
Longest Names
- 43 Richard Cheese & Lounge Against The Machine
- 26 The Red Jumpsuit Apparatus
- 24 Architecture in Helsinki
- 23 The Boy Least Likely To
- 23 The Black Dahlia Murder
- 23 Scary Kids Scaring Kids
- 21 The Whitest Boy Alive
- 21 The Pigeon Detectives
- 21 Streetlight Manifesto
- 21 Death From Above 1979
- 20 The Secret Handshake
- 20 The Polyphonic Spree
- 20 Midnight Juggernauts
- 20 Manchester Orchestra
- 20 Funeral for a Friend
- 20 From Autumn to Ashes
- 20 Bring Me the Horizon
- 19 Theory of a Deadman
- 19 The Beautiful Girls
- 19 Secondhand Serenade
2005 – 2009
Longest Names
- 37 Edward Sharpe and the Magnetic Zeroes
- 32 The Pains of Being Pure at Heart
- 32 Margot & the Nuclear So and So’s
- 30 Isobel Campbell & Mark Lanegan
- 29 You, Me, and Everyone We Know
- 29 The Good, the Bad & the Queen
- 27 dan le sac vs Scroobius Pip
- 27 The Rural Alberta Advantage
- 25 The Asteroids Galaxy Tour
- 25 Does It Offend You, Yeah?
- 24 The Tallest Man On Earth
- 24 The Airborne Toxic Event
- 24 Selena Gomez & The Scene
- 24 I Set My Friends on Fire
- 24 Forever the Sickest Kids
- 24 Clap Your Hands Say Yeah
- 23 The Last Shadow Puppets
- 23 Reverend and The Makers
2010 – 2014
Longest Names
- 51 Tim and Sam’s Tim and the Sam Band with Tim and Sam
- 37 Antoine Dodson & The Gregory Brothers
- 35 RPA and the United Nations of Sound
- 34 Noel Gallagher’s High Flying Birds
- 32 The Ghost Of A Saber Tooth Tiger
- 30 Destroy Rebuild Until God Show
- 27 Pussycat Dolls & Snoop Dogg
- 26 Rend Collective Experiment
- 25 Giorgos Alkaios & Friends
- 25 Frankie Rose and the Outs
- 25 Brooklyn Tabernacle Choir
- 24 Unknown Mortal Orchestra
- 24 Den svenska björnstammen
- 24 California Swag District
- 24 A Pale Horse Named Death
- 23 Young Artists for Haiti
- 23 The Jet Age Of Tomorrow
- 23 Jessie and the Toy Boys
- 23 Black Country Communion
Save Justin Bieber from the death metal
Posted by Paul in code, data, Music, The Echo Nest on January 1, 2012
I just finished my holiday break coding project. It’s a 3D music maze built with WebGL that runs in your browser. You can wander around the maze and sample music and enjoy the album art. It’s like being in 1992 with a fresh copy of Castle Wolfenstein 3D – but with music instead of Nazis. If you wander through the maze long enough you may stumble upon a little game embedded in the maze called ‘Save Justin Bieber from the death metal’. That’s all I’m going to say about that.
The maze uses Echo Nest playlists and 7Digital media (album art and 30 second samples). I used the totally awesome Three.js by my new hero MrDoob. You’ll need a WebGL-enabled browser like Google’s chrome. Give it a go here: The 3D Music Maze.
Update: Bieber Death Metal really exists.
Artists that called it a day in 2011
Posted by Paul in code, data, fun, The Echo Nest on December 18, 2011
It is that time of year when music critics make their year-in-review lists: best albums, worst albums, best new artists and so on. To help critics with their year-end review, I’ve put together a list of the top artists that stopped performing in 2011 – due to retirement, breaking up or due to death.
I made this list using by calling Echo Nest artist search call, limiting the results to artists with an ending year of 2011. Here’s the salient bit of python:
results = artist.search(artist_end_year_after=2010, artist_end_year_before=2012, buckets=['urls', 'years_active'], sort='hotttnesss-desc')
You can see the list of the 3,300 or so artists that stopped performing in 2011 here: Artists that called it a day in 2011. Thanks to Matt Santiago, master of data quality at The Echo Nest, for coming up with the idea for the list.
In the same vein, I created a list of the top 100 artists (based upon Echo Nest hotttnesss) that became active or released their first recording in 2011.
Check this list out at: Top New Artists for 2011
My Music Hack Day London hack
Posted by Paul in code, data, events, The Echo Nest on December 4, 2011
It is Music Hack Day London this weekend. However, I am in New England, not Olde England, so I wasn’t able to enjoy in all the pizza, beer and interesting smells that come with a 24 hour long hackathon. But that didn’t keep me from writing code. Since Spotify Apps are the cool new music hacking hotttnesss, I thought I’d create a Spotify related hack called the Artist Picture Show. It is a simple hack – it shows a slide show of artist images while you listen to them. It gets the images from The Echo Nest artist images API and from Flickr. It is a simple app, but I find the experience of being able to see the artist I’m listening too to be quite compelling.
Slightly more info on the hack here.
Building a Spotify App
Posted by Paul in code, Music, The Echo Nest on December 2, 2011
On Wednesday November 30, Spotify announced their Spotify Apps platform that will let developers create Spotify-powered music apps that run inside the Spotify App. I like Spotify and I like writing music apps so I thought I would spend a little time kicking the tires and write about my experience.
First thing, the Spotify Apps are not part of the official Spotify client, so you need to get the Spotify Apps Preview Version. This version works just like the version of Spotify except that it includes an APPS section in the left-hand navigator.
If you click on the App Finder you are presented with a dozen or so Spotify Apps including Last.fm, Rolling Stones, We are Hunted and Pitchfork. It is worth your time to install a few of these apps and see how they work in Spotify to get a feel for the platform. MoodAgent has a particularly slick looking interface:
A Spotify App is essentially a web app run inside a sandboxed web browser within Spotify. However, unlike a web app you can’t just create a Spotify App, post it on a website and release it to the world. Spotify is taking a cue from Apple and is creating a walled-garden for their apps. When you create an app, you submit it to Spotify and if they approve of it, they will host it and it will magically appear in the APPs sections on millions of Spotify desktops.
To get started you need to have your Spotify account enabled as a ‘developer’. To do this you have to email your credentials to platformsupport@spotify.com. I was lucky, it took just a few hours for my status to be upgraded to developer (currently it is taking one to three days for developers to get approved). Once you are approved as a developer, the Spotify client automagically gets a new ‘Develop’ menu that gives you access to the Inspector, shows you the level of HTML5 support and lets you easily reload your app:
Under the hood, Spotify Apps is based on Chromium so those that are familiar with Chrome and Safari will feel right at home debugging apps. Right click on your app and you can bring up the familiar Inspector to get under the hood of your application.
Developing a Spotify App is just like developing a modern HTML5 app. You have a rich toolkit: CSS, HTML and Javascript. You can use jQuery, you can use the many Javascript libraries. Your app can connect to 3rd party web services like The Echo Nest. The Spotify Apps supports just about everything your Chrome browser supports with some exceptions: no web audio, no video, no geolocation and no Flash (thank god).
Since your Spotify App is not being served over the web, you have to do a bit of packaging to make it available to Spotify during development. To do this you create a single directory for your app. This directory should have at least the index.html file for your app and a manifest.json file that contains info about your app. The manifest has basic info about your app. Here’s the manifest for my app:
% more manifest.json
{
"BundleType": "Application",
"AppIcon": {
"36x18": "MusicMaze.png"
},
"AppName": {
"en": "MusicMaze"
},
"SupportedLanguages": [
"en"
],
"RequiredPermissions": [
"http://*.echonest.com"
]
}
The most important bit is probably the ‘RequiredPermissions’ field. This contains a list of hosts that my app will communicate with. The Spotify App sandbox will only let your app talk to hosts that you’ve explicitly listed in this field. This is presumably to prevent a rogue Spotify App using the millions of Spotify desktops as a botnet. There are lots of other optional fields in the manifest. All the details are on the Spotify Apps integration guidelines page.
I thought it would be pretty easy to port my MusicMaze to Spotify. And it turned out it really was. I just had to toss the HTML, CSS and Javascript into the application directory, create the manifest, and remove lots of code. Since the Spotify App version runs inside Spotify, my app doesn’t have to worry about displaying album art, showing the currently playing song, album and artist name, managing a play queue, support searching for an artist. Spotify will do all that for me. That let me remove quite a bit of code.
Integrating with Spotify is quite simple (at least for the functionality I needed for the Music Maze). To get the currently playing artist I used this code snippet:
var sp = getSpotifyApi(1);
function getCurrentArtist() {
var playerTrackInfo = sp.trackPlayer.getNowPlayingTrack();
if (playerTrackInfo == null) {
return null;
} else {
return track.album.artist;
}
}
To play a track in spotify given its Spotify URI use the snippet:
function playTrack(uri) {
sp.trackPlayer.playTrackFromUri(uri, {
onSuccess: function() { console.log("success");} ,
onFailure: function () { console.log("failure");},
onComplete: function () { console.log("complete"); }
});
}
You can easily add event listeners to the player so you are notified when a track starts and stops playing. Here’s my code snippet that will create a new music maze whenever the user plays a new song.
function addAudioListener() {
sp.trackPlayer.addEventListener("playerStateChanged", function (event) {
if (event.data.curtrack) {
if (getCurrentTrack() != curTrackID) {
var curArtist = getCurrentArtist();
if (curArtist != null) {
newTree(curArtist);
}
}
}
});
}
Spotify cares what your app looks like. They want apps that run in Spotify to feel like they are part of Spotify. They have a set of UI guidelines that describe how to design your app so it fits in well with the Spotify universe. They also helpfully supply a number of CSS themes.
Getting the app up and running and playing music in Spotify was really easy. It took 10 minutes from when I received my developer enabled account until I had a simple Echo Nest playlisting app running in Spotify
Getting the full Music Maze up and running took a little longer, mainly because I had to remove so much code to make it work. The Maze itself works really well in Spotify. There’s quite a bit of stuff that happens when you click on an artist node. First, an Echo Nest artist similarity call is made to find the next set of artists for the graph. When those results arrive, the animation for the expanding the graph starts. At the same time another call to Echo Nest is made to get an artist playlist for the currently selected artist. This returns a list of ‘good’ songs by that artist. The first one is sent off to Spotify for it to play. Click on a node again and the next song it that list of good songs plays. Despite all these web calls, there’s no perceptible delay from the time you click on a node in the graph until you hear the music.
Here’s a video of the Music Maze in action. Apologies for the crappy audio, it was recorded from my laptop speakers.
[youtube http://youtu.be/finObm36V6Y]Here’s the down side of creating a Spotify App. I can’t show it to you right now. I have to submit it to Spotify and only when and if the approve it, and when they decided to release it will it appear in Spotify. One of the great things about web development is that you can have an idea on Friday night and spend a weekend writing some code and releasing it to the world by Sunday night. In the Spotify Apps world, the nimbleness of the web is lost .
Overall, the developer experience for writing Spotify Apps is great. It is a very familiar programming environment for anyone who’s made a modern web app. The debugging tools are the same ones you use for building web apps. You can use all your favorite libraries and toolkits and analytics packages that you are used to. I did notice some issues with some of the developer docs – in the tutorial sample code the ‘manifest.json’ is curiously misspelled ‘maifest.json’. The JS docs didn’t always seem to match reality. For instance, as far as I can tell, there’s no docs for the main Spotify object or the trackPlayer. To find out how to do things, I gave up on the JS docs and instead just dove into some of the other apps to see how they did stuff . (I love a world where you ship the source when you ship your app). Update – In the comments Matthias Buchetics points us to this Stack Overflow post that points out where to find the Spotify JavaScript source in the Spotify Bundle. At least we can look at the code until the time when Spotify releases better docs.
Update2 – here’s a gist that shows the simplest Spotify App that calls the Echo Nest API. It creates a list of tracks that are similar to the currently playing artist. Another Echo Nest based Spotify App called Mood Knobs is also on github.
From a technical perspective, Spotify has done a good job of making it easy for developers to write apps that can tap into the millions of songs in the Spotiverse. For music app developers, the content and audience that Spotify brings to the table will be hard to ignore. Still there are some questions about the Spotify Apps program that we don’t know the answer to:
- How quickly will they turn around an app? How long will it take for Spotify to approve a submitted app? Will it be hours, days, weeks? How will updates be managed? Typical web development turnaround on a bug fix is measured in seconds or minutes not days or weeks. If I build a Music Hack Day hack in Spotify, will I be the only one able to use it?
- How liberal will Spotify be about approving apps? Will they approve a wide range of indie apps or will the Spotify App store be dominated by the big music brands?
- How will developers make money? Spotify says that there’s no way for developers to make money building Spotify apps. No Ads, no revenue share. No 99 cent downloads. It is hard to imagine why developers would flock to a platform if there’s no possibility of making money.
I hope to try to answer some of these questions. I have a bit of cleanup to do on my app, but hopefully sometime this weekend, I’ll submit it to Spotify to see how the app approval process works. I’ll be sure to write more about my experiences as I work through the process.
The Music Matrix – Exploring tags in the Million Song Dataset
Posted by Paul in code, data, Music, The Echo Nest on November 27, 2011
Last month Last.fm contributed a massive set of tag data to the Million Song Data Set. The data set includes:
- 505,216 tracks with at least one tag
- 522,366 unique tags
- 8,598,630 (track – tag) pairs
A popular track like Led Zep’s Stairway to Heaven has dozens of unique tags applied hundreds of times.
There is no end to the number of interesting things you can do with these tags: Track similarity for recommendation and playlisting, faceted browsing of the music space, ground truth for training autotagging systems etc.
I think there’s quite a bit to be learned about music itself by looking at these tags. We live in a post-genre world where most music no longer fits into a nice tidy genre categories. There are hundreds of overlapping subgenres and styles. By looking at how the tags overlap we can get a sense for the structure of the new world of music. I took the set of tags and just looked at how the tags overlapped to get a measure of how often a pair of tags co-occur. Tags that have high co-occurrence represent overlapping genre space. For example, among the 500 thousand tracks the tags that co-occur the most are:
- rap co-occurs with hip hop 100% of the time
- alternative rock co-occurs with rock 76% of the time
- classic rock co-occurs with rock 76% of the time
- hard rock co-occurs with rock 72% of the time
- indie rock co-occurs with indie 71% of the time
- electronica co-occurs with electronic 69% of the time
- indie pop co-occurs with indie 69% of the time
- alternative rock co-occurs with alternative 68% of the time
- heavy metal co-occurs with metal 68% of the time
- alternative co-occurs with rock 67% of the time
- thrash metal co-occurs with metal 67% of the time
- synthpop co-occurs with electronic 66% of the time
- power metal co-occurs with metal 65% of the time
- punk rock co-occurs with punk 64% of the time
- new wave co-occurs with 80s 63% of the time
- emo co-occurs with rock 63% of the time
It is interesting to see how the subgenres like hard rock or synthpop overlaps with the main genre and how all rap overlaps with Hip Hop. Using simple overlap we can also see which tags are the least informative. These are tags that overlap the most with other tags, meaning that they are least descriptive of tags. Some of the least distinctive tags are: Rock, Pop, Alternative, Indie, Electronic and Favorites. So when you tell someone you like ‘rock’ or ‘alternative’ you are not really saying too much about your musical taste.
The Music Matrix
I thought it might be interesting to explore the world of music via overlapping tags, and so I built a little web app called The Music Matrix. The Music Matrix shows the overlapping tags for a tag neighborhood or an artist via a heat map. You can explore the matrix, looking at how tags overlap and listening to songs that fit the tags.
With this app you can enter a genre, style, mood or other type of tag. The app will then find the 24 tags with the highest overlap with the seed and show the confusion matrix. Hotter colors indicate high overlap. Mousing over a cell will show you the percentage overlap between the two corresponding tags and clicking on a cell will play a track that has high tag counts for the two tags. I find that I can learn a lot about a genre of music by looking at the 24 tag neighborhood for a genre and listening to examples. Some interesting neighborhoods to explore are:
You can also explore by moods:
If you are not sure what genre or style is for an artist, you can just start with the top tags for the artist like so:
Use the Music Matrix to explore a new genre of music or to find music that matches a set of styles. Find out how genres overlap. Listen to prototypical examples of different styles. Click on things, have fun. Check it out:
The code for the Music Matrix is on Github. Thanks to Thierry for creating the Million Song Data Set (the best research data set ever created) and thanks to Last.fm for contributing a very nice set of tag data to the data set.
Music Hack Day Boston 2011
Music Hack Day Boston 2011 is in the can. But what a weekend it was. 250 hackers from all over New England and the world gathered at the Microsoft NERD in Cambridge MA for a weekend of hacking on music. Over the course of the weekend, fueled by coffee, red bull, pizza and beer, we created 56 extremely creative music hacks that we demoed in a 3 hour music demo extravaganza at the end of the day on Sunday.
Music Hack Day Boston is held at the Microsoft NERD in Cambridge MA. This is a perfect hacking space – with a large presentation room for talks and demos, along with lots of smaller rooms and nooks and crannies for hackers to camp out .
Hackers started showing up at 9AM on Saturday morning and by 10AM hundreds of hackers were gathered and ready to get started.
After some intelligent and insightful opening remarks by the MC, about 20 companies and organizations gave 5 minute lightening workshops about their technology.
There were a few new (to Music Hack Day) companies giving workshops: Discogs announced Version 2 of their API at the Music Hack Day; Shoudio – the location based audio platform. Peachnote – and API for accessing symbolic music ngram data; EMI who were making a large set of music and data available for hackers as part of their OpenEMI initiative; the Free Music Archive showed their API to give access to 40,000 creative commons licensed songs and WinAmp – showed their developer APIs and network.
After lunch, hacking began in earnest. Some organizations held in-depth workshops giving a deeper dive in to their technologies. Hacking continued in to the evening after shifting to the over night hacking space at The Echo Nest.
Hackers were ensconced in their nests while one floor below there was a rager DJ’d by Ali Shaheed Muhammad (one third of A Tribe called Quest).
Thanks to the gods of time, we were granted one extra hour over night to use to hack or to sleep. Nevertheless, there were many bleary eyes on Sunday morning as hackers arrived back at the NERD to finish their hacks.
Finally at 2:30 PM at 25+ hours of hacking, we were ready to show our hacks.There was an incredibly diverse set of hacks including new musical instruments, new social web sites, new ways to explore for music. The hacks spanned from the serious to the whimsical. Here are some of my favorites.
Free Music Archive Radio – this hack uses the Echo Nest and the Creative Commons licensed music of the Free Music Archive to create interesting playlists for use anywhere.
Mustachiness – Can you turn music into a mustache? The answer is yes. This hack uses sophisticated moustache caching technology to create the largest catalog of musical mustaches in history.
Bohemian Rhapsichord – Turning a popular song into a musical instrument. This is my hack. It lets you play Bohemian Rhapsody like you’ve never played it before.
Spartify – Host a Party and let people choose what songs to play on Spotify. No more huddling in front of one computer or messing up the queue!
Snuggle – I want you to snuggle this. Synchronize animated GIFs to jams of the future. These guys get the prize for most entertaining patter during their demo.
Drinkify – Never listen to music alone again – This app has gone viral. Han, Lindsay and Matt built an app to scratch their own itch. Drinkify automatically generates the perfect cocktail recipe to accompany any music.
Peachnote Musescore and Noteflight search – searching by melody in the two social music score communities.
bitbin – Create and share short 8-bit tunes
The Videolizer – music visualizer that syncs dancing videos to any song. Tristan’s awesome hack – he built a video time stretcher allowing you to synchronize any video that has a soundtrack to a song. The demos are fantastic.
The Echo Nest Prize Winners
Two hacks received the Echo Nest prizes:
unity-echonest – An echonest + freemusicarchive dynamic soundtrack plugin for Unity3D projects. This was a magical demo. David Nunez created a Unity3D plugin that dynamically generates in game soundtracks using the Echo Nest playlist API and music from the Free Music Archive. Wow!
MidiSyncer – sync midi to echo nest songs. Art Kerns built An iPhone app that lets you choose a song from your iTunes library, retrieves detailed beat analysis information from Echo Nest for the song, and then translates that beat info to MIDI clock as the song plays. This lets you sync up an electronic music instrument such as a drum machine or groovebox to a song that’s playing on your iPhone. So wow! Play a song on your iPod and have a drum machine play in sync with it. Fantastic!
Hardware Hacks
Some really awesome hardware hacks.
Neurofeedback – Electroencephalogram + strobe goggles + Twilio Chat Bot + Max/MSP patches which control Shephard-risset rhythms and binaural beats
Sonic Ninja – Zebra Tube Awesomeness – John Shirley develops PVC helmholtz resonator while hacking a WiiMote and bluetooth audio transmission.
SpeckleSounds – Super-sensitive 3D Sound Control w/ Lasers! Yes, with lasers.
Kinect BeatWheel – Control a quantized looping sample with your arm
Demo Fail
There were a few awesome hacks that were cursed by the demo demi gods. Great ideas, great hacks, frustrating (for the hacker) demos. Here are some of the best demo fail hacks .
Kinetic – Kinetic Typography driven by user selected music and text. This was a really cool hack that was plagued by a podium display issue leading to a demi-demo-fail. But the Olin team regrouped and posted a video of the app.
BetterTaste – improve your Spotify image – this was an awesome idea – use a man-in-the-middle proxy to intercept those embarassing scrobbles. Unfortunately Arkadiy had a network disconnect that lead to a demo fail.
Tracker – Connect your turntable to the digital world. Automatically identifies tracks, saves mp3s, and scrobbles plays, while displaying a beautiful UI that’s visible from across the room, or across the web. Perhaps the most elaborate of the demos – with a real Hi Fi setup including a turntable. But something wasn’t clicking, so Abe had to tell us about it instead of showing it.
Carousel – tell the story behind your pictures – it was a display fail – but luckily Johannes had a colleague who had his back and re-gave the demo. That’s what hacker friends are for.
This was a fantastic weekend. Thanks to Thomas Bonte of MuseScore for taking these super images. Special thanks to the awesome Echo Nest crew lead by Elissa for putting together this event, staffing it and making it run like clockwork. It couldn’t have happened without her. I was particularly proud of The Echo Nest this week. We created some awesome hacks, threw a killer party, and showed how to build the future of music while having a great time. What a place to work!
Bohemian Rhapsichord – a Music Hack Day Hack
Posted by Paul in code, events, Music, The Echo Nest on November 6, 2011
It is Music Hack Day Boston this weekend. I worked with my daughter Jennie (of Jennie’s Ultimate Roadtrip fame) to build a music hack. This year we wanted to build a hack that actually made music. And so we built Bohemian Rhapsichord.

Bohemian Rhapsichord is a web app that turns the song Bohemian Rhapsody into a musical instrument. It uses TheEcho Nest analyzer to break the song into segments of quasi-stable musical events. It then shows these as an array of colored tiles (where the colors are based on timbre) that you can interact with like a musical instrument.
If you click on a tile, you play that portion of the song (or hold down shift or control and play tiles just by mousing over them). You can bind different segments to keys letting you play the ‘instrument’ with your keyboard too (See the FAQ for all the details). You can re-sort the tiles based on a few criteria (sequential order, by loudness, duration or by similarity to the last played note). It is a fun way to make music based on one of the best songs in the world.
The app makes use of the very new (and not always the most stable) web audio API. Currently, the only browser that I know that supports the web audio API is Chrome. The app is online so give it a try: Bohemian Rhapsichord
Search for music by drawing a picture of it
I’ve spent the weekend hacking on a project at Music Hack Day Montreal. For my hack I created an application with the catchy title “Search for music by drawing a picture of it”. The hack lets you draw the loudness profile for a song and the app will search through the Million Song Data Set to find the closest match. You can then listen to the song in Spotify (if the song is in the Spotify collection).
Coding a project in 24 hours is all about compromise. I had some ideas that I wanted to explore to make the matching better (dynamic time warping) and the lookup faster (LSH). But since I actually wanted to finish my hack I’ve saved those improvements for another day. The simple matching approach (Euclidean distance between normalized vectors) works surprisingly well. The linear search through a million loudness vectors takes about 20 seconds, too long for a web app, this can be made palatable with a little Ajax .
The hack day has been great fun, kudos to the Montreal team for putting it all together.




































