FFT Visuals in Open Frameworks

I had been wanting to do some sound driven animations and visualizers for a while but had always managed to put it off for one thing or another. I had looked at some options and ended up using ofxFFT addon by Kyle McDonald. After quickly looking through his example  was able to create some of my own visuals and customize the visualizer settings at runtime. Below is the result of my first stable iteration :

The video allows you to see the animation http://vimeo.com/29234695

But how does it work? There are several options you can take for sound analysis. The simplest example would be the audio input example provided with openFrameworks 007 which provides you with stereo channels of audio and the scaled average.

But this wasn’t enough information. Sure both input channels and the average values are good starting point, but I wanted to be able to have bass control one animation, and have the higher registers control another graphic. I kept looking and came across this post on the openFrameworks forums, which detailed the ofxFFT addon created By Kyle McDonald ( http://kylemcdonald.net/ ) available here : http://code.google.com/p/kyle/downloads/list

This was a solution I could use! I looked at Kyle’s example and started to play. The addon uses FFT method or the Fast Fourier Transform. This process ( which is more detailed here : http://www.dspguru.com/dsp/faqs/fft ) allows a large set of data, like waveform sound data, into a smaller set of data which we can work with. One of the first issues I ran into was that lots of music I tested did not have a high range. I needed a way to limit my visuals to only work within certain ranges. Below you can see that the ranges of each circle animation are clearly marked making it easy to setup on site, tweak settings to music,  and save them for the show.

FFT Range Detail

Through testing I found that classical music like Gustav Holst : http://grooveshark.com/s/Mars+The+Bringer+Of+War/1t79vR?src=5 or Dubstep such as Dodge +& Fuski : http://grooveshark.com/s/Guettastep/3Hi4WY?src=5 worked really well for testing out sound and ranges. Rock and pop seemed to be very limited to the bottom register. This is just a first iteration but I’ll continue to work on it and improve the tool. I included project files and tested it for CodeBlocks on Windows and xCode on OSX Snow Leopard.  All the source code is available on my github at : https://github.com/benMcChesney/ofFFtPlayground


  • Kdcl03

    hello ben, I’m student from Korea , I’m OF beginner,I very like you project, so I download this project from your github, I use  Mac OSX Snow Leopard and OF 007, I wanna ask which linker should I use, Is ofSoundPlayer???or others, because If want project running, openframework linker file is xxx.a, but I can’t found in your project. Could you give me  some advise??

    Ming Chun
    thanks

  • Anonymous

    Hello! From a clean OF 007 you should be able to open the xcode project and republish to get the application to run. If you are having trouble try cleaning the project first to see if that helps. The only other issue I could see is if in the header search paths or linker paths are all relative, they should be but it’s worth a double check.

  • http://twitter.com/milesalex Alex Miles

    Hey Ben,

    I’m at student learning openFrameworks. I cloned your files into a clean OF 007 release ( of007/apps/addonsExamples/ofFFtPlayground) but could not get the project to build. I’m in xCode 3 and very new to developing with C++. Do you have any advice for me to get this working and learn from your code?

    Thank you so much for taking the time to write about openFrameworks.

    Best,
    Alex

  • Anonymous

    Hi Alex.

    If you have the emptyExample app running in apps/examples/emptyExample just duplicate the folder, rename it and copy and replace the source files. Then add the ofxFFT addon as you normally would in your IDE . I was using xcode 4 that might be why the project file is a gibing you trouble

  • Joshua Batty

    Hey ben,

    I got this to compile, but its running at 0.7fps. Seems weird. Im on xcode 3 on osx 10.6.8. 
    Have you got any suggestions as to what parts of the code would be making it so slow?