The Wub Machine
UPDATE: I turned the Wub Machine into a website. Go and remix your own tracks!
I like dubstep.
There, I said it!
That massive bassline, two-step beat and killer rhythm has some odd allure that I can’t resist – and I’m typically a fan of rock, metal and prog!
I’m also a huge fan of the Echo Nest and their brilliant Remix API. In their words, the Remix API is an “internet synthesizer” – quite true. I can send off an mp3, and get back extremely detailed beat, timbre and pitch information within seconds. Some people have already used this to make any song swing, put a donk on any song, and much, much more.
For the first SE Hack Day, I decided to use the Remix API to automagically add dubstep to any song.
Now, as you may be able to tell from the samples above, this isn’t quite ready yet. In fact, it’s extremely rough. Even the code looks horrifically ugly. (And yes, you can download it, fork it, and edit it freely – it’s open sourced on GitHub.) I have a lot of work left to make the results sound passable.
Technically, I’m not really doing anything too complicated:
- I used Logic Pro and Native Instruments’ new Reaktor synth to make some dirty, dirty wub basslines at the proper dubstep tempo (140 bpm) and mangled my own kick and snare samples. I then rendered 8 bars of this pattern, in two different variants, in every key of one octave.
- Using Python and the Echo Nest Remix API, I get an analysis of each track’s bars, beats, pitches, timbres and more. I still need to make some better use of this information, as right now, a lot of songs end up being detected and used improperly. (an 8th or 16th note off, ruining the beat)
- Using the Echo Nest Remix API’s Dirac time-stretching abilities, I take the input song, bar-by-bar, and alter the tempo to be exactly 140bpm. Then, for each “section” of the song (as defined by, again, the API’s analysis) I do 16 bars of dubstep with a repeating 8-bar pattern of either beats, bars or tatums (notes) from the original song.
- For the dubstep backing, I take whatever key the API tells me the song is in, and just choose the corresponding backing file from the ones I’ve prerendered.
- For the intro, I have a pre-rendered intro with some noise sweeps. I then use a bit of brute-force audio manipulation to play a build-up pattern before the initial “drop” after 8 bars.
I’m taking a ton of suggestions on how to improve the script – adding variables for time till drop, allowing overrides if the API mis-identifies the key or tempo, and allowing a different choice of beat, bar or tatum for sampling the original song. There’s obviously tons of work left to do, and I plan to improve it whenever I get the chance.
Let me know what you think below in the comments, leave some suggestions, and check out the code on GitHub if you’re interested!
UPDATE: I built a web interface and a very nice-looking site around the basic algorithm. Go and remix your own tracks!
P.S: When I said I like dubstep, I meant I really do like dubstep. When I’m not making my own music, I also enjoy drumming to dubstep: