A c++ version of the matlab code found in animated dubstep.