How Students Listen
The Spotify Insights team took a deep dive into some of the listening data of college students to see if there were any differences in how students at different schools listen. We looked at a wide range of data including what artists were played, what songs were played and when, what playlists played, what genres were played and so on. We focused mostly on looking for distinctive listening patterns and behaviors at the different schools. The results were a set of infographic style visualizations that summarize the distinctive listening patterns for each school.
It was a fun study to do and really shows how much we learn about listening behavior based upon music streaming behavior. Read about the study on the Spotify Insights Blog: Top 40 Musical Universities in America:How Students Listen
More on “Where’s the Drama?”
Posted by Paul in code, events, Music, music hack day, Spotify, The Echo Nest on September 8, 2014
My Music Hack Day Berlin hack was “Where’s the Drama?” – a web app that automatically identifies the most dramatic moment in any song and plays it for you. I’ve been having lots of fun playing with it … and even though (or perhaps because) I know how it works, I’m often surprised at how well it does at finding the most dramatic moments. Here are some examples:
- When will the Bass Drop – Lonely Island
- Stairway to Heaven – Led Zeppelin
- Doomsday – Nero
- November Rain – Guns N Roses
How does it work? The app grabs the detailed audio analysis for the song from The Echo Nest. This includes a detailed loudness map of the song. This is the data I use to find the drama. To do so, I look for the part of the song with the largest rise in volume over the course of a 30 second window (longer songs can have a bit of a longer dramatic window). I give extra weight to crescendos that culminate in louder peaks (so if there are two crescendos that are 20dB in range but one ends at 5dB louder, it will win). Once I identify the most dynamic part of a song, I pad it a bit (so we get to hear a bit of the drop after the build).
The rest is just UI – the song gets plotted as a heavily filtered loudness curve with the dramatic passage highlighted. I plot things with Highcharts, which is a pretty nifty javascript plotting and charting library. I recommend.
Playing the music – I wanted to use Spotify to play the music, which was a bit problematic since there currently isn’t a way to play full streams with the Spotify Web API, so I did a couple of hacky hacks that got me pretty far. First of all, I discovered that you can add a time offset to a Spotify URI like so:
When this URI is opened in Spotify (even when opened via a browser), Spotify will start to play the song a the 1:05 time offset.
I still needed to be able to stop playing the track – and there’s no way to do that directly – so instead, I just open the URI:
which happens to be the URI for John Cage’s 4’33. In other words, to stop playing one track, I just start playing another (that happens to be silent). The awesome side effect of this is that I’ll be slowly turning anyone who uses “Where’s the Drama?” into experimental music listeners as the Spotify recommendation system responds to all of those John Cage ‘plays’. This should win some sort of ‘hackiest hack of the year’ award.
It was a fun hack to make, and great fun to demo. And now that I have the app, I am no longer wasting time listening to song intros and outros, I can just get to the bit of the song that matters the most.
Where’s the Drama?
Posted by Paul in Uncategorized on September 6, 2014
I’m at Music Hack Day Berlin this week where I’m just finishing up my hack called Where’s the Drama?
Where’s The Drama? will automatically find the most dramatic bits in your favorite music, so you can skip right to the best part of the song. No need to listen to anything else. Here’s a video of the app in action:
[youtube https://www.youtube.com/watch?v=D_ctniiyOcI&feature=youtu.be]So get out your cigarette lighter, stand up and start to listen more dramatically.
The app is online, but please treat it gently – it has a really hacky Spotify integration that will probably fall over if you look at it too hard. The code is on github.
Acrostify – make Spotify playlists with embedded secret messages
Posted by Paul in code, fun, Spotify, The Echo Nest on August 8, 2014
For my summer vacation early-morning coding for fun project I revamped my old Acrostic Playlist Maker to work with Spotify. The app, called Acrostify, will generate acrostic playlists with the first letter of each song in the playlist spelling out a secret message. With the app, you can create acrostic playlists and save them to Spotify.
The app was built using The Echo Nest and Spotify APIs. The source is on github.
Give it a try at Acrostify.
Outside Lands Recommendations
Posted by Paul in code, events, hacking, recommendation, Spotify, The Echo Nest on July 27, 2014
I am at Outside Hacks this weekend – A hackathon associated with the Outside Lands music festival. For this hack I thought it would be fun to try out the brand new Your Music Library endpoints in the Spotify Web API. These endpoints let you inspect and manipulate the tracks that a user has saved to their music. Since the hackathon is all about building apps for a music festival, it seems natural to create a web app that gives you festival artist recommendations based upon your Spotify saved tracks. The result is the Outside Lands Recommender:
The Recommender works by pulling in all the saved tracks from your Spotify ‘Your Music’ collection, aggregating the artists and then using the Echo Nest Artist Similar API to find festival artists that match or are similar to those artists. The Spotify API is then used to retrieve artist images and audio samples for the recommendations where they are presented in all of their bootstrap glory.
This was a pretty straight forward app, which was good since I only had about half the normal hacking time for a weekend hackathon. I spent the other half of the time building a festival dataset for hackers to use (as well as answering lots of questions about both the Spotify and Echo Nest APIs).
It has been a very fun hackathon. It is extremely well organized, the Weebly location is fantastic, and the quality of hackers is very high. I’ve already seen some fantastic looking hacks and we are still a few hours from demo time. Plus, this happened.

Two more victims
Outside Lands lineup
I’m on my way to Outside Hacks – a hackathon tied in with the Outside Lands music festival. Since many hacks at the hackathon will be related to the festival it is pretty important to have a machine-readable version of the artist lineup for the festival. However, I couldn’t find any online. Since I had an hour in the airport lounge, and the airport actually has decent WiFi, I thought I would try to be a good hacker citizen and generate an easily parseable lineup.
A little python + some BeautifulSoup and a bit of Echo Nest Rosetta Data and I have created an Outside Lands lineup JSON that includes links to artist pages, plus Echo Nest, Spotify and Rdio IDs. The JSON is hosted online at:
http://static.echonest.com/OutsideLands/lineup_2014.json
Here’s the code:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from bs4 import BeautifulSoup | |
| import json | |
| import pyen | |
| en = pyen.Pyen() | |
| def get_fid(artist, idspace): | |
| if 'foreign_ids' in artist and len(artist['foreign_ids']) > 0: | |
| for fids in artist['foreign_ids']: | |
| if fids['catalog'] == idspace: | |
| return fids['foreign_id'] | |
| return None | |
| def en_artist_lookup(name): | |
| response = en.get('artist/search', name=name, | |
| bucket=['id:spotify', 'id:rdio-US']) | |
| artists = response['artists'] | |
| if len(artists) > 0: | |
| artist = artists[0] | |
| print artist | |
| enid = artist['id'] | |
| spid = get_fid(artist, 'spotify') | |
| rdio = get_fid(artist, 'rdio-US') | |
| if rdio: | |
| rdio = rdio.split(':')[2] | |
| print name, '/', artist['name'], enid, spid, rdio | |
| ids = { | |
| 'echonest':enid, | |
| 'spotify':spid, | |
| 'rdio':rdio | |
| } | |
| return ids | |
| return {} | |
| if __name__ == '__main__': | |
| lineup = [] | |
| f = open(sys.argv[1]) | |
| html_doc = f.read() | |
| soup = BeautifulSoup(html_doc) | |
| for a in soup.find_all('a', class_='band'): | |
| name = a.text.strip() | |
| ids = en_artist_lookup(name) | |
| artist = { | |
| 'artist' : name, | |
| 'link' : a['href'], | |
| 'ids' : ids | |
| } | |
| lineup.append(artist) | |
| out = open('lineup_2014.json', 'w') | |
| print >> out, json.dumps(lineup, indent=4) | |
| out.close() |
It’s about time to get on the plane. If you can think of other interesting data to add to the lineup json let me know and I’ll try to add it before the hackathon.
Fetching my saved tracks from Spotify
The @SpotifyPlatform team just pushed out an update to the Spotify Web API that lets a developer retrieve and manipulate the tracks that a user has saved in ‘Your Music’. To show off this new functionality I wrote a quick demo that shows how to fetch the saved tracks for a Spotify user via the nifty new API. The demo will first solicit permission from the user, and if the user grants such permissions, the app will then retrieved the saved tracks and show them as a simple list.
The demo is on line here: My Saved Tracks and the source is on github.
Set Listener update – now listen to specific shows in Spotify
Posted by Paul in code, Spotify, The Echo Nest on July 21, 2014
Last month I released the Set Listener – a web app that lets you create a Spotify playlist for an artist’s most recent show. A frequent request by users has been to allow the creation of a Spotify playlist for any show, not just the most recent one. However, I didn’t want to have to implement an elaborate event search and browse feature (this was supposed to be a quick hack) especially since SetList.fm already implements this browsing. So instead I did a bit of hack to implement this feature – in addition to accepting an artist name, the Set Listener will accept the url of any setlist.fm show. If you enter a setlist.fm show URL, the Set Listener will grab the songs for that show and generate the playlist. Here’s the flow:
Go to setlist.fm and browse until you find your show of interest. Grab the URL
Paste the URL into the Set Listener and you should be good to go:
1st Web Audio Conference
This January IRCAM and Mozilla will be hosting the 1st Web Audio Conference in Paris France. From the conference page:
The WAC is the first international conference on web audio technologies and applications.
The conference welcomes web R&D developers, audio processing scientists, application designers and people involved in web standards.
The conference addresses research, development, design, and standards concerned with emerging audio-related web technologies such as Web Audio API, Web RTC, Web Sockets, and Javascript.
Contributions to the first edition of WAC are encouraged in, but not limited to, the following topics:
- Innovative audio and music based web applications (with social and user experience aspects)
- Client-side audio processing (real-time or non real-time)
- Audio data and metadata formats and network delivery
- Server-side audio processing and client access
- Client-side audio engine and rendering
- Frameworks for audio manipulation
- Web Audio API design and implementation
- Client-side audio visualization
- Multimedia integration
- Web standards and use of standards within audio based web projects
- Hardware, tangible interface and use of Web Audio API
This is the first Call For Papers that I’ve seen that, in addition to a paper and poster track, also has a Gig submission track. Yes, you can propose a 20 minute gig. Accepted gigs will be presented in the conference concert. I’m thinking of a combined Infinite Jukebox + Ellie Goulding visualization – 20 minutes of flying cubes will show ’em.
The submission deadline is October 10. Time to dust off my Latex skills.
Most Distinctive Fourth of July Songs
Independence day is just a few days away so I spent a bit of time over the weekend digging into the data to see what are the most listened to songs on the Fourth of July. Eliot wrote a great piece about the data for the Spotify Blog: The Most Distinctive Fourth of July Songs in the 50 U.S. States. Here I dig in a bit deeper.
From a musical perspective, The Fourth of July is a very interesting holiday. It’s a big summer outdoor party – and the music reflects that. On the Fourth, people listen to patriotic songs, BBQ songs, popular songs, party songs, songs about place and history. People listen to wide range of genres, from rock and pop to folk, country, marches, and new weird america. To see what music people listen to on the Fourth I went through about 5,000 playlists that people have created that have ‘fourth of july’ in the title. I aggregated the songs across all of these playlists and created a playlist of the top 100 or songs.
As you can see, the playlist is a mix of US-centric music and summer party music – which is a pretty good reflection of what people actually listen to on the Fourth of July. But I wanted to go a bit further and see what music was particularly distinctive for the Fourth of July – as compared to any other summer outdoor party playlist. To do this, I collected the top most frequently appearing songs on the Fourth of July playlists and scored each song by calculating the ratio of the play counts that occurred on July 4, 2013 in the U.S. vs. play counts for the song during the following weeks. Songs that were played much more frequently on the Fourth than during the rest of July get a much higher score. Ranking songs by this ratio yields the list of distinctive Fourth of July Songs:
I think it is a pretty good list of the music that we listen to more on the Fourth of July than on any other day. There’s a John Philip Sousa march, Woody Guthrie’s This Land is Your Land, Katy Perry’s Firework, lots and lots of country music. Some artists appear more frequently than others – Bruce Springsteen, John Mellencamp and Lee Greenwood are Fourth of July favorites.
I’m always interested in regional differences in how we listen to music, so I looked at the listening in each state in the U.S. to see which of the core Fourth of July songs was listened to more. If you look just at the most popular Fourth of July song in each state the results are pretty boring – the most popular song in 46 out of 50 states for July 2013 was Party in the USA by Miley Cyrus – but if you look at the distinctive score (the ratio of plays on the fourth to plays during the following weeks), you get a more nuanced view of how people listen to music. Of course we represent this as a map:
So the real question is, are these playlists generated by data mining any good? As actual playlists to listen to, I don’t think so. They are too incoherent, with jumps that take you from a sappy country song, to a teen pop song, to a march that will give you iPod whiplash. Compare the playlists above to a human-curated Fourth of July Playlist:
This is a much more listenable playlist. However, I think the data mined playlists do provide an excellent starting point – a big pool of Fourth of July songs. With a genre and popularity filter these could be turned into decent, listenable playlists. Similarly, give this pool of Fourth of July songs to a team of music curators and they can build some pretty fantastic Fourth of July playlists for every type of music fan.






