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:
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
- 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 (http://stackoverflow.com/questions/6012246/why-is-python-easy-install-not-working-on-my-mac)
- PIL (http://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1053.html)
- mutagen (http://mutagen.googlecode.com/files/mutagen-1.18.tar.gz with instruction at http://forums.musicbrainz.org/viewtopic.php?id=1988)
- echonest (http://code.google.com/p/echo-nest-remix/) note: you will need to create an account with echonest to get an API Key
- lame (http://lame.sourceforge.net/ and instructions at http://hints.macworld.com/article.php?story=20011030023450799)
- shntool (http://etree.org/shnutils/shntool/ or use the Homebrew package manager for OSX with: brew install shntool)
- soundstretch (http://www.surina.net/soundtouch/download.html)
Once I got all the dependencies installed using wub-machine was as easy as:
?> python dubstep.py 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.