Archive for category fun

Artists that called it a day in 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

, , , ,

3 Comments

Search for music by drawing a picture of it

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.

, ,

Leave a Comment

Looking for the Slow Build

This is the second in a series of posts exploring the Million Song Dataset.

reddit post titled 'what is your favorite song that builds'

Every few months you’ll see a query like this on Reddit – someone is looking for songs that slowly build in intensity.  It’s an interesting music query since it is primarily focused on what the music sounds like.  Since we’ve analyzed the audio of millions and millions of tracks here at The Echo Nest we should be able to automate this type of query.   One would expect that Slow Build songs will have a steady increase in volume over the course of a song, so lets look at the loudness data for a few Slow Build songs to confirm this intuition.  First, here’s the canonical slow builder: Stairway to Heaven:

Loudness plot of Stairway to HeavenThe green line is the raw loudness data, the blue line is a smoothed version of the data.  Clearly we see a rise in the volume over the course of the song.  Let’s look at another classic Slow Build – The Hall Of the Mountain King – again our intuition is confirmed:

Loudness Plot for The Hall of the Mountain King

Looking at a non-Slow Build song like Katy Perry’s California Gurls we see that the loudness curve is quite flat by comparison:

Loudness Plot for California Gurls by Katy Perry

Of course there are other aspects beyond loudness that a musician may use to build a song to a climax – tempo, timbre and harmony are all useful, but to keep things simple I’m going to focus only on loudness.

Looking at these plots it is easy to see which songs have a Slow Build.  To algorithmically identify songs that have a slow build, we can use a technique similar to the one I described in The Stairway Detector.  It is a simple algorithm that compares the average loudness of the first half of the song to the average loudness of the second half of the song.  Songs with the biggest increase in average loudness rank the highest.   For example, take a look at a loudness plot for Stairway to Heaven.  You can see that there is a distinct rise in scores from the first half to the second half of the song (the horizontal dashed lines show the average loudness for the first and second half of the song). Calculating the ramp factor we see that Stairway to Heaven scores an 11.36 meaning that there is an increase in average loudness of 11.36 decibels between the first and the second half of the song.

This algorithm has some flaws – for instance it will give very high scores  to ‘hidden track’ songs.  Artists will sometimes ‘hide’ a track at the end of a CD by padding the beginning of the track with a few minutes of silence.  For example, this track by ‘Fudge Tunnel’ has about five minutes of silence before the band comes in.

Extra by Fudge Tunnel

Clearly this song isn’t a Slow Build, our simple algorithm is fooled.  To fix this we need to introduce a measure of how straight the ramp is.   One way to measure the straightness of a line is to calculate the Pearson correlation for the loudness data as a function of time.  XY Data with correlation that approaches one (or negative one) is by definition, linear. This nifty wikipedia visualization of the correlation of different datasets shows the correlation for various datasets:

We can combine the correlation with our ramp factors to generate an overall score that takes into account the ramp of the song as well as the straightness of the ramp.   The overall score serves as our Slow Build detector.  Songs with a high score are Slow Build songs.   I suspect that there are better algorithms for this so if you are a math-oriented reader who is cringing at my naivete please set me and my algorithm straight.

Armed with our Slow Build Detector, I built a little web app that lets you explore for  Slow Build songs.   The app - Looking For The Slow Build – looks like this:

Screenshot of Looking for the slow build app

The application lets you type in the name of your favorite song and will give you a plot of the loudness over the course of the song, and calculates the overall Slow Build score along with the ramp and correlation.  If you find a song with an exceptionally high Slow Build score it will be added to the gallery.  I challenge you to get at least one song in the gallery.

You may find that some songs that you think should get a high Slow Build score don’t score as high as you would expect.  For instance, take the song Hoppipolla by Sigur Ros.  It seems to have a good build, but it scores low:

Loudness plot for Hoppipolla by Sigur Ros

It has an early build but after a minute it has reached it’s zenith. The ending is symmetrical with the beginning with a minute of fade. This explains the low score.

Another song that builds but has a low score is Weezer’s  The Angel and the One.

Loudness plot for Weezer's the Angel and the One

This song has a 4 minute power ballad build – but fails to qualify a a slow build because the last 2 minutes of the song are nearly silent.

Finding Slow Build songs in the Million Song Dataset

Now that we have an algorithm that finds Slow Build songs, lets apply it to the Million Song Dataset.   I can create a simple MapReduce job in Python that will go through all of the million tracks and calculate the Slow Build score for each of them to help us find the songs with the biggest Slow Build.  I’m using the same framework that I described in the post “How to Process a Million Songs in 20 minutes“.  I use the S3 hosted version of the Million Song Dataset and process it via Amazon’s Elastic MapReduce using mrjob – a Python MapReduce library.  Here’s the mapper that does almost all of the work, the full code is on github in cramp.py:

    def mapper(self, _, line):
        """ The mapper loads a track and yields its ramp factor """
        t = track.load_track(line)
        if t and t['duration'] > 60 and len(t['segments']) > 20:
            segments = t['segments']
            half_track = t['duration'] / 2
            first_half = 0
            second_half = 0
            first_count = 0
            second_count = 0

            xdata = []
            ydata = []
            for i in xrange(len(segments)):
                seg = segments[i]
                seg_loudness = seg['loudness_max'] * seg['duration']

                if seg['start'] + seg['duration'] <= half_track:
                    seg_loudness = seg['loudness_max'] * seg['duration']
                    first_half += seg_loudness
                    first_count += 1
                elif seg['start'] < half_track and seg['start'] + seg['duration'] > half_track:
                    # this is the nasty segment that spans the song midpoint.
                    # apportion the loudness appropriately
                    first_seg_loudness = seg['loudness_max'] * (half_track - seg['start'])
                    first_half += first_seg_loudness
                    first_count += 1

                    second_seg_loudness = seg['loudness_max'] * (seg['duration'] - (half_track - seg['start']))
                    second_half += second_seg_loudness
                    second_count += 1
                else:
                    seg_loudness = seg['loudness_max'] * seg['duration']
                    second_half += seg_loudness
                    second_count += 1

                xdata.append( seg['start'] )
                ydata.append( seg['loudness_max'] )

            correlation = pearsonr(xdata, ydata)
            ramp_factor = second_half / half_track - first_half / half_track
            if YIELD_ALL or ramp_factor > 10 and correlation > .5:
                yield (t['artist_name'], t['title'], t['track_id'], correlation), ramp_factor

This code takes less than a half hour to run on 50 small EC2 instances and finds a bucketload of Slow Build songs.   I’ve created a page of plots of the top 500 or so Slow Build songs found by this job. There are all sorts of hidden gems in there. Go check it out:

Looking for the Slow Build in the Million Song Dataset

The page has 500 plots all linked to Spotify so you can listen to any song that strikes your fancy.  Here are some my favorite discoveries:

Respighi’s The Pines of the Appian Way

I remember playing this in the orchestra back in high school. It really is sublime. Click the plot to listen in Spotify.

Pines of the Appian Way

Maria Friedman’s Play The Song Again

So very theatrical

Play the song again

 Mandy Patinkin’s Rock-A-Bye Your Baby With A Dixie Melody

Another song that seems to be right off of Broadway – it has an awesome slow build.

Rockabye baby with a dixie melody
There are thousands and thousands of slow build songs.  I’ve created a table with all the songs that have a score of above 10 on the Slow Build scale (recall that Stairway to Heaven scores a 9, so this is a table of about 6K songs that are bigger Slow Build songs than Stairway).
Conclusion
This just about wraps up the most complex blog post I’ve ever made with a web app, a map-reduce program, and a jillion behind the scenes scripts to make tables and nice looking plots – but in the end, I found new music that I like so it was worth it all.  Here’s a summary of all the resources associated with this post:
Thanks to Spotify for making it so easy to find music with their meta-data API and make links that play music. Apologies to all of the artists with accented characters in their names, I was encoding-challenged this weekend, so my UTF is all WTF.

, , ,

12 Comments

Searching for chilled metal

It seems like every heavy metal band has at least one chill-out song – from Metallica’s Nothing Else Matters to Led Zeppelin’s That’s the Way.   These tracks give some relief from the otherwise relentless pounding of the hammer of the gods.  It’d be nice to be able to collect up a bunch of these chilled-metal songs into a playlist – perfect for when your mom’s visiting (she tells me that she doesn’t like pounding metal).

ChilLed Zeppelin - Some rights (by-nc-sa) reserved by Heinrich Klaffs

To find chilled metal, we can use The Echo Nest API.  The Echo Nest has calculated a wide range of acoustic and musical attributes for millions of songs. One such attribute is energy .  We can make  a simple song/search query for heavy metal songs that have low energy.  These will be our chilled-metal songs that your mom enjoys so much.  Here’s the API query:

http://developer.echonest.com/api/v4/song/search?&style=heavy+metal&sort=energy-asc

This query searches for songs by heavy metal artists, and sorts the results in order of ascending energy (so the lowest energy tracks will be returned first).  The query does a really good job of finding chilled metal.  Here’s a sampling of the results:


Sphinx (The Guardian) by Black Sabbath

Sphinx (The Guardian) by Black Sabbath  - energy: 0.0003


Demon Driver reprise by Gillan

Demon Drive by Gillan - energy: 0.010


The Return by Saxon

The Return by Saxon - energy: 0.013


Solitude by Judas Priest

Solitude by Judas Priest  - energy: 0.049


Joan of Arc by UFO

Joan of Arc by UFO – Energy: 0.05


Fear by Black Label Society

Fear by Black Label Society Energy – 0.119


You can also use the Echo Nest Playlist API to generate a chilled metal playlist.   Here’s a call to create a playlist of chilled metal in XSPF format.

http://developer.echonest.com/api/v4/playlist/static?api_key=N6E4NIOVYMTHNDM8J&style=heavy+metal&max_energy=.1&type=artist-description&bucket=id:7digital&bucket=tracks&limit=true&format=xspf

You can toss this playlist into a player like VLC or Songbird that supports XSPF and start listening to chilled metal right away (30 second samples only) like this:

% curl 'http://developer.echonest.com/api/v4/playlist/static?api_key=N6E4NIOVYMTHNDM8J\
   &style=heavy+metal&max_energy=.1\
   &type=artist-description&bucket=id:7digital&bucket=tracks&limit=true\
   &format=xspf' > chilled-metal.xspf
% open chilled-metal.xspf

There you go, you now have all the tools you need to keep your chilled metal queue filled and fresh, almost everything you need to keep your mom happy.

Thanks much to 7Digital for providing audio clips and album art.

, ,

4 Comments

Loudest songs in the world

Lots of ink has been spilled about the Loudness war and how modern recordings keep getting louder as a cheap method of grabbing a listener’s attention.   We know that, in general, music is getting louder. But what are the loudest songs? We can use The Echo Nest API to answer this question.  Since the Echo Nest has analyzed millions and millions of songs, we can make a simple API query that will return the set of loudest songs known to man.  (For the hardcore geeks, here’s the API query that I used).   Note that I’ve restricted the results to those in the 7Digital-US catalog in order to guarantee that I’ll have a 30 second preview for each song.

So without further adieu, here are the loudest songs


Topping and Core by Grimalkin555

The song Topping and Core by Grmalking555 has a whopping loudness of  4.428 dB.


Modifications by Micron

The song Modifications  by Micron has a loudness of  4.318 dB.


Hey You Fuxxx! by Kylie Minoise

The song Hey You Fuxxx! by Kylie Minoise with a loudness of 4.231 dB

Here’s a little taste of Kylie Minoise live (you may want to turn down your volume)


War Memorial Exit by Noma


The song War Memorial Exit by Noma with a loudness of 4.166 dB


Hello Dirty 10 by Massimo

The song Hello Dirty 10 by Massimo with a loudness of 4.121 dB.


These songs are pretty niche. So I thought it might be interesting to look the loudest songs culled from the most popular songs.  Here’s the query to do that.  The loudest popular song is:

Welcome to the Jungle by Guns 'N Roses

The loudest popular song is Welcome to the Jungle by Guns ‘N Roses with a loudness of -1.931 dB.


You may be wondering how a loudness value can be greater than 0dB.  Loudness is a complex measurement that is both a function of time and frequency.  Unlike traditional loudness measures, The Echo Nest analysis models loudness via a human model of listening,  instead of  directly mapping loudness  from the recorded signal. For instance, with a traditional dB model a simple sinusoidal function would be measured as having the same exact “amplitude” (in dB) whether at 3KHz or 12KHz. But with The Echo Nest model, the loudness is lower at 12KHz than it is at 3KHz because you actually perceive those signals differently.

Thanks to the always awesome 7Digital for providing album art and 30 second previews in this post.

, ,

5 Comments

Bipolar Radio

I just finished my  hack for Music Hack Day SF. It is called Bipolar Radio.   It is your standard Pandora-style artist radio but with a twist. Type in an artist, and you’ll get an endless stream of music by similar artists.   When you need to hear a high energy song, just click on the yellow happy face and you’ll instantly hear a high energy song by the currently playing artist.  Similarly, if you’d like to chill out, just click on the green face and you’ll instantly hear a low energy song that should help you relax a bit.

The hack uses the Echo Nest song data to help find the high and low energy songs. I use a combination of loudness, energy, danceability, and tempo to sort and filter the songs by an artist into the high and low energy buckets.  I’m taking advantage of the new Rdio / Echo Nest integration to get Rdio IDs so I can play them in Rdio’s nifty player.

Give it a whirl and let me know what you think:   Bipolar Radio

,

2 Comments

Memento Friday

It had to be done. Created with Echo Nest Remix.

3 Comments

The SXSW Music Maze

There are thousands of artists playing at SXSW this year. To help sort it all out, I thought I’d adapt my Music Maze to work within the world of SXSW 2011 artists.   It is a good way to figure out which bands you’d like to see.

This visualization fits in with the SXSW talk I’m giving in a few days: Finding Music With Pictures

Leave a Comment

Is that a hipster in your pocket, or are you just glad to see me?

Yes, this app will mock your music taste and then will tell you what you really should be listening to. It’s Pocket Hipster.

,

Leave a Comment

Finding the most dramatic bits in music

Evanescence is one of my guilty listening pleasures. I enjoy how Amy Lee’s voice is juxtaposed against the wall of sound produced by the rest of the band.   For instance, in the song Imaginary, there’s a 30 seconds of sweet voice + violins before you get slammed by the hammer of the gods:

This extreme change in energy makes for a very dramatic moment in the music.  It is one of the reasons that I listen to progressive rock and nu-metal (despite the mockery of my co-workers).    However, finding these dramatic gems in the music is hard – there’s a lot of  goth- and nu-metal to filter through, and much of it is really bad. After even just a few minutes of listening I feel like I’m lost at a Twicon.   What I need is a tool to help me find these dramatic moments, to filter through the thousands of songs to find the ones that have those special moments when the beauty comes eye to eye with the beast.

My intuition tells me that a good place to start is to look at the loudness profile for songs with these dramatic moments.  I should expect to see a sustained period of relatively soft music followed by sharp transition to a sustained period of loud music.  This is indeed what we see:

 

Loudness plot for 'Imaginary'

This plot shows a windowed average of the Echo Nest loudness for the first 50 seconds of the song.  In this plot we see a relatively quiet first 10 seconds (hovering between -21 and -18 db), followed by an extremely loud section of around -10db). (Note that this version of the song has a shorter intro than the version in the Youtube video).  If we can write some code to detect these transitions, then we will have a drama detector.

The Drama Detector: Finding a rising edge in a loudness profile is pretty easy,  but we want to go beyond that and make sure we have a way to rank then so that we can find the most dramatic changes.  There are two metrics that we can use to rank the amount of drama:  (1) The average change in loudness at the transition and (2) the length of the quiet period leading up to the transition.  The bigger the change in volume and the the longer it has been quiet means more drama.  Let’s look at another dramatic moment as an example:

The opening 30 seconds of Blackest Eyes by Porcupine Tree fit the dramatic mold. Here’s an annotated loudness plot for the opening:

The drama-finding algorithm simply looks for loudness edges above a certain dB threshold and then works backward to find the beginning of the ‘quiet period’.  To make a ranking score that combines both the decibel change and the quiet period, I tried the simplest thing that could possible work which is to just multiply the change in decibels by the quiet period (in seconds).  Let’s try this metric out on a few songs to see how it works:

  • Porcupine Tree – Blackest Eyes – score:  18 x 24 = 432
  • Evanescence – Imaginary (w/ 30 second intro) – score: 299
  • Lady Gaga – Poker Face- score: 82 – not very dramatic
  • Katy Perry – I kissed a girl – score: 33 – extremely undramatic

This seems to pass the sanity test, dramatic songs score high, non-dramatic songs score  low (using my very narrow definition of dramatic).   With this algorithm in mind, I then went hunting for some drama.  To do this, I found the 50 artists most similar to Evanescence, and for each of these artists I found the 20 most hotttest songs. I then examined each of these 1,000 songs and ranked them in dramatic order.  So, put on your pancake and eye shadow, dim the lights, light the candelabra and enjoy some dramatic moments

First up is the wonderfully upbeat I want to Die by Mortal Love.   This 10 minute long song has a whopping drama score of  2014. There a full two minutes of quiet starting at 5 minutes into the song before the dramatic moment (with 16 dB of dramatic power!) occurs:

The dramatic moment occurs at 7:12 seconds into the song – but I’m not sure if it is worth the wait.  Not for me, but probably something they could play at the Forks Washington High School prom though.

The song Jillian by Within Temptation gets a score of  861 for this dramatic opening:

Now that’s drama!  Take a look at the plot:

The slow build – and then the hammer hits.  You can almost see the vampires and the werewolves colliding in a frenzy.

During this little project I learned that most of the original band members of Evanescence left and formed another band called We are the Fallen – with a very similar sound (leading me to suspect that there was a whole lot of a very different kind of drama in Evanescence). Here’s their dramatic Tear The World Down (scores a 468):

Finally we have this track Maria Guano Apes – perhaps my favorite of the bunch:

 

Update: @han wondered how well the dramatic detector faired on Romantic-era music.  Here’s a plot for Berlioz’s Symphony Fantastique: March to the Scaffold:

This gets a very dramatic score 361.   Note that in the following rendition the dramatic bit that aligns with the previous plot occurs at 1:44:

Well – there you have it , a little bit of code to detect dramatic moments in music. It can’t, of course, tell you whether or not the music is good, but it can help you filter music down to a small set where you can easily preview it all.   To build the drama detector, I used  a few of The Echo Nest APIs including:

  • song/search – to search for songs by name and to get the analysis data (where all the detailed loudness info lives)
  • artist/similar – to find all the similar artists to a seed (in this case Evanescence)

The code is written in Python using pyechonest,  and the plots were made using gnuplot.   If you are interested in finding your own dramatic bits let me know and I’ll post the code somewhere.

, , ,

5 Comments

Follow

Get every new post delivered to your Inbox.

Join 91 other followers