Simple binauralization using FFTW

Hello everybody,

I am currently working on a small university project, where I try to implement a simple stereo binauralization plugin using the Juce framework in conjunction with FFTW3.

During development I’ve encountered two major problems. The first being, that the fftw convolution of my HRTF files seems to be only working correctly for half of the requested data length (I’ve written a small python script to validate my buffer contents).

The second problem is, that the compiled VST3 file isn’t accepted by Cubase or the Juce PluginHost, whenever I use the FFTW3 library. I guess I have to provide the library files together with the build in some way, but couldn’t find a solution yet.

Here’s the link to my source code repo:

Thanks in advance, for any suggestions

Hi greyparrot,

I guess you are developping on windows, right? Then, you indeed need either to put the fft3 dll files close to the VST dll (as far as I remember it works, but it’s not clean), or in a folder that’s in Windows’ PATH environment variable, or to update the PATH with the folder containing them.



If you don’t like dynamic linking, you can compile the FFTW library as a static lib using cmake, and link it statically to your project.

1 Like

Thanks for the advice. I’ve already tried adding my FFTW directory to PATH (ah and yes I am working on Windows) and copying the .dll into the VST directory of my DAW. But I will look into statically linking the lib, maybe that’ll work for me.

@greyparrot: You shouldn’t add the whole FFTW directory to the path (there is no recursive search as far as I know) but only the very directory containing the dlls.

And: as far as I remember, there are 3 dlls to be considered: libfftw3-3, libfftw3f-3, libfftw3l-3 (to be verified)

As for your first question (convolution working correctly for half of the requested data length): well, it depends how you perform convolution. Maybe a few tips:
. don’t forget that you need overlap and add, whatever you use partitioned convolution or not. I.e. don’t forget the tail of the convolved block. This means for example, if you don’t partition neither the input audio block nor your impulse response that the fft size needs to be the smallest power of two above the sum (block size + impulse response size).
. check that you did not confuse real fft and complex fft, this can mess everything up.