FFT in XNA Content Pipeline for Beat Detection For The Win!

jwatte's picture

I worked a bit more on the FFT-based music visualizer program I started the other day, and it's doing great! A this point, I have a pretty solid rhythm extraction thing going, and I can use autocorrelation (through autoconvolution) of the extracted rhythm track to derive tempo. I'm assuming 4/4 beats here, but... that's a pretty safe assumption for any popular music :-) (And a lot of not-so-popular music, too)

The cutting plane in this screen shot is the "play position" of the song being played back, and it flashes when my "rythm event" detector detects a hit; for four-on-the-floor music, it's very correlated with the bass drum, but even for sparser or denser type mixes, it does a great job of finding useful "hit points" for events in sync with music. Once I have tempo, i can detect sudden shifts in adherence to the tempo, and/or density, to trigger "style" changes, too.

I've attached my music processor used as a pre-process here. You may re-use it under the terms of the MIT open source license. Also note that this requires the djbfft library, which is available under a similar license.

AttachmentSize
disco-music-2.jpg86.48 KB
fft-processor.zip317.98 KB