ofxFft: FFTW + KISS FFT wrapper

i don’t know the problem here, but i’ve moved ofxFft to github to help development https://github.com/kylemcdonald/ofxFft

Sorry I didn’t read the readme thoroughly enough.
Only the fftw win32 lib was inside the addon.

After adding the osx fftw lib everything worked perfectly!

Many many thanks!

Dunno if this is the best place but I just wanted to add some details for any other new people trying to use this on windows/vs2010, because I beat my head against it for quite a while (again, not the most experienced c++ or OF coder…) Some of this is generic addons + vs stuff, some of it may be stupid obvious i don’t know. I was using the github-version which seems to have a slightly outdated readme. Anyway, what i had to do to get it building in vs:

[list]

  • Go to project properties > C/C++ > Additional Include Directories and add of/addons/ofxFft/src/** of/addons/ofxFft/libs/kiss** and of/addons/ofxFft/libs/fftw/include

  • Download the precompiled-fftw-dll from github and stick it in your bin directory. I tried using the latest 64bit Fftw libraries and ended up in an interminable nightmare of link errors so stick with the library kyle provides.

  • The dll is fine for running executables but if you want to use the code you need an import library. You can use some VC-tools-to-get-one-from-the-dll.
    [list][li]open a console, find your dll and run dumpbin /exports libfftw3f-3.dll > libfftw3f-3.def

  • open the** libfftw3f-3.def** you just made in a text editor and remove the headers and ordinals etc till you’ve just got a list of export names.

  • Add LIBRARY libfftw3f-3.dll EXPORTS at the top. File should now look something like this:
    [/list][/li][/list]

  
  
LIBRARY libfftw3f-3.dll  
EXPORTS  
SFFTW_CLEANUP@0  
SFFTW_CLEANUP_THREADS@0  
SFFTW_DESTROY_PLAN@4  
SFFTW_EXECUTE@4  
...  

[list]

  • [li]
    Save it and run lib /DEF:libfftw3f-3.def to generate the lib file.
    [/li]

  • move the libfftw3f-3.lib you just created to of/addons/ofxFft/libs/fftw/lib/win32

  • open your project again and hit up project properties > Linker > General > Additional Library Directories and add of/addons/ofxFft/libs/fftw/lib/win32

  • go to Linker > Input > Additional Dependencies and add libfftw3f-3.lib

  • Finally, in your project, recreate the addon directory structure using filters and add in the existing addon sources into the project: addons\ofxFft\libs\fftw\include*, addons\ofxFft\libs\kiss* and addons\ofxFft\src*

[/list]

Build and you should be good to go. Hope this saves someone else some time!

How do I change the device ID for the input?
I get ‘RtApiDs::probeDeviceOpen: device (0) does not support input!’ and I think it’s because device 0 is my USB soundcard without input. But I don’t know how to change the default device.

if you have an ofSoundStream soundStream then you want to set the device ID using soundStream.setDeviceID(…)

any ideas about where I could find which is missing in ofxFft/libs/fftw/lib/ to use with ofxFft ?

Everything is here: https://github.com/kylemcdonald/ofxFft but I just miss the pure fftw part :-/

In the docs, it is written

  1. Add to your compiler search path:
    of/addons/ofxFftw/src/
    of/addons/ofxFftw/libs/kiss

but I don’t have any ofxFftw…
is it an error ?

it seems the rule of …/…/…/ to retrieve the libs or addons folder from the apps is broke here.
I cannot successfully fix it :-/

anyone?

julien, the lib is in the downloads/ https://github.com/kylemcdonald/ofxFft/downloads

if you clone the repository to addons/, use the lib from the downloads, then run the example it should work fine. i was just testing it last week with 007 on osx.

Hi

I have some trouble getting this to work in CB on Win7. I’m pretty sure I’ve put everything where it’s supposed to be as described in the readme. I also used this as guidance:
http://forum.openframeworks.cc/t/getting-ofxgui-to-work-in-code::blocks/9229/0

I’ve created an emptyExample in which I’m just trying to get it to compile without any code added. Hoever, I get this error:

of_prerelease_v007_win_cb\addons\ofxFft\src\ofxFftw.h:15: error: ‘fftwf_plan’ does not name a type

Any ideas? Also, is there a general guide of how to test out examples of addons made in Xcode, when you are using CB? This certainly won’t be the only time I will need to do this and it must happen to quite a lot of people quite often. :slight_smile:

Ok, I got it to work in Visual Studio 2010 - thanks futuresandwich! :slight_smile:

Perhaps we should get some VS2010 examples included? Perhaps we could make a package with all examples packaged as VS2010 solutions? I’d love to do it but I don’t really know how to create multiple solutions, without having to build all from scratch for each example…

Got all the samples to work in Code Blocks (at least for windows, haven’t tested others). I’ve provided a zip here, in which all the sample projects have been converted to CB projects. If I’m doing something wrong about posting this, let me know. Most of it is built on the instructions of futuresandwich, so thanks a lot to him and kylemcdonald. :slight_smile:

To use these examples:

  1. Download ofxFft and make sure it is located at of/addons/ofxFft.
  2. Download the libraries fftw-libs.zip and extract the win32 folder to of/addons/ofxFft/libs/fftw/lib
  3. Download the zip I provide (ofxFft-examples-cb.zip) with this post, and extract libfftw3f-3.lib to of/addons/ofxFft/libs/fftw/lib/win32 (the folder you just extracted from the other zip in step 2)
    4. Extract from ofxFft-examples-cb.zip all the example folders to of/apps/addonsExamples
    EDIT: I have been notified that the folder should now be (I have not confirmed this as I don’t have the stuff right here but I trust that kennethone is correct):
  4. Extract from ofxFft-examples-cb.zip all the example folders to of/apps/Examples/addons
  5. Open any workspace of the samples and it should compile and run without problems.

I’ve tested it out on a fresh installation and it seems to work fine for me this way. :slight_smile:

ofxFft-examples-cb.zip

Thank you very much for this one, finally I was able to try this addon, great job you have done.

I must add that it only worked with your initial settings, with the example folders on /of/apps/addonsExamples/ and not one directory further.

EDIT: One other thing that I forgot:

At least on v0073 we must change the linker settings | link libraries poco file names (the path is ok), we must change:

…\libs\poco\lib\win_cb\libPocoNetmt.a
to
…\libs\poco\lib\win_cb\libPocoNet.a

and so on for all the 4 poco files.

I lost so much time trying to set this thing up and with your help it was quite fast to have it working.

THANK YOU!!!

you both have been very helpful, but there is still one error left…

  
mingw32-g++.exe: obj\release\addons\ofxFft\src\ofxEasyFft.o: No such file or directory  

A quick search reveals this-thread, but there’s no solution there. Any ideas?

Hi,

I’ve been playing around with the EasyExample which works well.
Now I’m trying to do some sort of FFT synthesis.
But after a few hours I don’t succeed at all.
In fact I managed to get a working sound stream in a test project, but I’m still wondering how to get some spectrally treated or generated signal out of the ofxFft class …
I manage to get some poor results with fft->getAmplitude() and fft->getPhase(), but I guess I should use fft->getSignal().
Am I on the right way ?
Or do the addon need some improvements to offer a simple interface to create spectral audio effects and generators ?
Actually the only thing I’m getting with fft->getSignal() (called in audioRequested()) is the original, unmodified incoming signal I write in audioReceived() with fft->setSignal().

Thank you in advance for any advice
Joseph

Mmmmh … it seems that I didn’t read the whole thread.
Finally I got a modified version of the EQ example to work.
In fact I can say the FFT-> IFFT works perfectly when no transformation is done to the amplitude signal, but as soon as I try to apply a spectral equalization (with a simple gaussian) some audio clics occur. The equalization sounds effective but the signal is pretty much destroyed.
I don’t know if I should try to improve the way I apply filtering (by applying the gaussian in the bark scale rather than in the frequency scale, or by smoothing the amplitude bins …?), or if the problem lies somewhere else.
These clics sound like a problem that could arise from applying a hamming envelope in a wrong way (they are periodic, like a window).
This can’t be a mutex problem because I lock everything in audioReceived() and audioRequested(), and it’s the only way I get clean signal with no transformation (otherwise sporadic noise bursts occur).
Or maybe this could be a phase issue. Am I supposed to modify the phase bins anytime I modify the amplitude bins to keep some kind of coherence between them ? I don’t remember reading so anywhere.

Again, thank you for any clue.

Joseph

Hey @kylemcdonald, this addon is helping me a lot, thanks for putting it together.

One (hopefully simple) question for or anyone else here, is there a way to separate input channels for separate FFTs?

I have 2 input channels that I want to keep separate.

I’m seeing on other forum postings that audio input in oF is interleaved so it needs to be separated manually, is the same the case here?

Hey Kyle,
I might met some problems here to run all the ofxfft examples, I had downloaded the precompiled libraries, and put it in the lib folder,
but I can’t find #define USE_FFTW in ofxFft.h. So how to fix that, I am totally lost==
thank you very much

I think you may need to add the CoreVideo framework to your project:

Hi!

I try to run example-basic over and over on Visual Studio2012, but always fail to do it.
These are my errors.

expected constant expression
’avgCol’ : unknown size
cannot allocate an array of constant size 0

And they are in the same sentence:59 in ofxProcessFFT.cpp.
What should I do?
Thank you in advance for any advice

Ryota