Automatic Dubstep & Electro: The Wub Machine

Yesterday Peter Kirn reported on the Montreal Music Hack Day on Create Digital Music and shared a link to Peter Sobot’s project, The Wub Machine.

Screen shot 2011 10 04 at 8.39.52 AM1 Automatic Dubstep & Electro: The Wub Machine

The Wub Machine

The Wub Machine takes any piece of audio as input and spits out either a dubstep or an electro version. The project is available on GitHub or as a web app though it seems the web app has fallen due to too much traffic. Here is an example of what The Wub Machine did to Ob-La-Di, Ob-La-Da by the Beatles:

Ob-La-Di, Ob-La-Da (Wub Machine Remix) by ccockerill

Here is how Peter Sobot describes his project and the tech he used to build it:

“The Wub Machine was a great little auto-remixer project – some audio hackery in Python to make a neat script. Unfortunately, I can probably count on one hand the number of people who *actually* downloaded the script and tried it on their own songs. So, I decided to make it into a web app.

I opened up my trusty Photoshop, cranked out some multicoloured waves and set “The Wub Machine” in beautiful Proxima Nova. Then I set about the immense task of actually implementing the remixer on the web.

I’d go into the technical impressiveness of the system, and how it’s brilliant and took me months to come up with… but it’s really not. It’s one big hack.

I ended up using:

  • PHP to serve the front-end, as well as serve the AJAX progress updates and interface with SoundCloud
  • Python to power and tie together all of the processing on the back-end
  • The Echo Nest Remix API to do the heavy lifting, audio analysis and beat detection
  • FFMPEG to decode & encode the MP3s
  • Mutagen and PIL to rewrite the MP3’s metadata, extract artwork, overlay a graphic and put it back in to the final MP3
  • Beanstalkd to queue processing jobs and connect PHP to Python
  • SQLite3 for logging and some queue intelligence
  • HTML5 Audio, used for a beautiful HTML5 player (taken from the extremely impressive Neutron Creations blog)
  • Flash for the fallback player on older browsers
  • Javascript and jQuery to hold together the very rickety frontend
  • CSS3 animations, for the moving waves at the top of the page
  • The SoundCloud API for sharing tracks (without putting me at risk of nasty legal issues or pushing storage constraints)

I did have to make a couple changes to the original algorithm, though:

I realized that audio volume is a nonlinear curve, so I had to account for that and create a new mixing algorithm. The volume of the original track vs. the wubwubs is now almost always about 50%.

I went back into my dubstep template in Logic Pro and added different types of TransitionFX samples to the intro and the wubs – booms, splashes and such. Although I’m still not happy with certain parts of the template, it’ll have to do for now. I’m not a dubstep producer – I’m a rock/metal/electronica/jazz guy. (for now!)

I made the algorithm as deterministic as possible. The remixer is essentially a function (depending on the analysis I get back from the Echo Nest) so if you put in the same song, you should get the exact same remix.

I improved the loudness calculation algorithms, fixed some stupidly-inefficient bugs, killed off a statistically-improbable-but-still-possible infinite loop, added logging, error handling, and progress indicators.

Since my blog post about the initial hack, it’s taken me 3 weeks to assemble this web front end. That said, there’s probably still tons of bugs – it only accepts MP3s at the moment, and it’s probably somewhat unstable. If I push it too hard, or post it to Reddit or Hacker News, my shiny new Linode will probably spontaneously combust. Be gentle!”

I had mixed results using the web app, probably because it is getting pounded (the site is actually down as I write this) so I went ahead and downloaded wub-machine from GitHub and installed it on my Mac. There were a fair number of dependencies that I had to install (more than were listed on the GitHub page):

  • Python distribute (
  • PIL (
  • mutagen ( with instruction at
  • echonest ( note: you will need to create an account with echonest to get an API Key
  • lame ( and instructions at
  • shntool ( or use the Homebrew package manager for OSX with: brew install shntool)
  • soundstretch (

Once I got all the dependencies installed using wub-machine was as easy as:

?> python mysong.mp3

This is an awesome project and I think it is great that Peter has shared the list of tech he used to build it. He also let me know today that he will be doing a full open-source release of the entire site and web front-end in the next week or so.

Share and Enjoy:
  • printfriendly Automatic Dubstep & Electro: The Wub Machine
  • digg Automatic Dubstep & Electro: The Wub Machine
  • stumbleupon Automatic Dubstep & Electro: The Wub Machine
  • delicious Automatic Dubstep & Electro: The Wub Machine
  • facebook Automatic Dubstep & Electro: The Wub Machine
  • yahoobuzz Automatic Dubstep & Electro: The Wub Machine
  • twitter Automatic Dubstep & Electro: The Wub Machine
  • googlebookmark Automatic Dubstep & Electro: The Wub Machine
  • reddit Automatic Dubstep & Electro: The Wub Machine

About jjob

I'm a technologist and a music producer. I make sound, write code and build things with electronics and microcontrollers.
This entry was posted in code, hack, make, online, Python, script, sound, web and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *