Infinite Gangnam Style

This weekend at Music Hack Day Reykjavik I built a music hack called Infinite Gangnam Style.  This hack takes the viral hit by Psy and creates a never ending, ever changing version of the song.   Here’s a video of it:

The app works by taking the audio and analyzing it with The Echo Nest analyzer to break it up into its individual beats. Next, an analysis pass is run on all the beats finding each beat’s nearest similar sounding neighbors that fall within a similarity threshold.  Then, the song is played beat-by-beat – but with the added twist that any time we play a particular beat there’s a chance that we will transition instead to one of the beat’s similar sounding neighbors. For a pop song like Gangnam Style there’s lots of repetition so there’s plenty of good transition points.  The result is that we can loop through the song forever with the song always morphing.

Since the Gangnam Style video is a key part of the song, I’ve included a dynamically remixed video in the web app too.  (The mixing is done just be image swapping, there’s no way to dynamically control a video player as far as I know, which is why this app will load about 2000 images ;).

Check out Infinite Gangnam Style and the rest of the Music Hack Day Reykjavik Hacks.  Update:  Check out the iPhone version

This hack was inspired by Tristan’s “James Brown Forever ” hack.

  1. #1 by online beat mixer on October 28, 2012 - 12:21 pm

    Ola! Musicmachinery,
    Thanks for that Today technologies has made it easy to create new music than before. Newcomers also can create startling audio on the internet using net centered new music producers. It’s not essential anymore to make new music from scratch. In fact some of the much better on line beat generators have databases of a large number of beats and effects for one to pick from. It is your choice to pick chords, kicks and diverse other music effects from the enormous selection of sounds.
    Regards

  2. #2 by Nathaniel Higgins on October 28, 2012 - 4:33 pm

    In order to avoid the image hack, just use HTML5 video which is easy to change the player position. Just change the currentTime property.

  3. #3 by droope on October 28, 2012 - 5:41 pm

    Good stuff! Loved it. Thanks

  4. #4 by rmo on October 28, 2012 - 6:19 pm

    Hey Paul, this is fantastic!
    Just a quick note –performance isn’t spectacular, but the html5 tag is very much dynamically controllable!
    If you have a single video to hop around through, just as with you can use its “currentTime” property as a setter, and while you /can/ change the “src” property to switch videos, this will obviously introduce latency, so you’re best off hiding a few ‘s and DOM-swapping on cue.
    But to get the “enterprise-grade” snap that such an app as this demands, you’ll need to pay due attention to the seekable TimeRanges and canplaythrough’s demonstrated here:
    http://www.w3.org/2010/05/video/mediaevents.html

    • #5 by rmo on October 28, 2012 - 6:21 pm

      [that’s hard to read when “tags” are mistakenly-stripped! –ed]

      Hey Paul, this is fantastic!
      Just a quick note –performance isn’t spectacular, but the html5 <video> tag is very much dynamically controllable!
      If you have a single video to hop around through, just as with <audio> you can use its “currentTime” property as a setter, and while you /can/ change the “src” property to switch videos, this will obviously introduce latency, so you’re best off hiding a few <video>‘s and DOM-swapping on cue.
      But to get the “enterprise-grade” snap that such an app as this demands, you’ll need to pay due attention to the seekable TimeRanges and canplaythrough’s demonstrated here:
      http://www.w3.org/2010/05/video/mediaevents.html

      • #6 by Paul on October 29, 2012 - 12:43 pm

        rmo -thanks for the tips. When I get back from Iceland, I’ll take a look at doing real video — P

  5. #7 by swarajban on October 28, 2012 - 6:23 pm

    This is awesome dude, any chance you could post the source? I’m really into house music and would love to try something like this with other tracks.

  6. #9 by swarajban on October 28, 2012 - 6:24 pm

    This is awesome dude, any chance you can post the source? I’m really into house music and would love to try something like this out with other tracks.

    • #10 by matt kane's brain on October 28, 2012 - 8:20 pm

      This is 100% JavaScript.

      • #11 by swarajban on October 28, 2012 - 8:49 pm

        Wow, my bad. Thanks!

    • #12 by Joseph Turian on October 28, 2012 - 8:25 pm

      I also would love to see code.

  7. #13 by Richard Barnett on October 29, 2012 - 5:07 pm

    This is fantastic. It’s like an audio equivalent of Markov chain based text generation (eg http://www.eblong.com/zarf/markov/). What do the different colours in the grid represent? (I should spend some time looking at the source to work it out; something to do with the similarity to another beat?)

    How time-consuming is the underlying analysis? How easy would it be to point this at any mp3(s) to apply the same technique?

    • #14 by Paul on October 30, 2012 - 3:37 am

      Richard – the colors indicate how likely we are to branch to/from a particular beat. Red blocks have the highest probability, blue are lower and black have zero. The analysis takes about 5 seconds. It would be trivial to do this for another song. — Paul

  8. #15 by Mike Nowak (@n0wak) on October 31, 2012 - 4:29 pm

    there’s no way to dynamically control a video player as far as I know

    I’m not entirely up to date on the video HTML5 API, but you could easily manage this in Flash (amongst other techs), no?

    • #16 by Paul on November 2, 2012 - 8:26 am

      perhaps – but I don’t want to use flash.

  9. #17 by Gordon Rios on November 1, 2012 - 7:57 pm

    It’s a lot of fun but it does set a pretty low bound for the complexity of this particular song ;)

  10. #18 by Bo Begole on November 13, 2012 - 1:42 pm

    You’re killing us, Paul! :-) My kids LOVE this.

    • #19 by Paul on November 13, 2012 - 2:55 pm

      hey bo! good to hear from you and glad your kids like it!