Posts Tagged drama

More on “Where’s the Drama?”

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:

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.

 Where_is_the_Drama_

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. 

, , , , , ,

3 Comments

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