Constraint FFT analysis

Looking for a fast and performant fft library for Juce which can analyse constrained parts of the soundspectrums e.g. fft with 2048 window size executed only between bin 100 and 150. Has anybody a hint?

by my modest knowledge, FFT methods do not support calculating just a part of the spectrum or time. I’d be delighted if someone knows a method for that ofcourse…
If FFTW does not list the option ( see https://www.fftw.org), then it probably doesnt exist.

1 Like

if you want to just scan a narrow frequency spectrum, you might do it “by hand”, without the FFT trick. You then simply do a DFT, calculating only the frequencies you need.
For reference how to do it, look here Simple DFT in C | ad hocumentation • n. fast documentation of ideas and solutions.

don’t forget that the length of your analysis window needs to be considerably bigger than your lowest frequencies period. so there is a clear limit to the amount of CPU you can gain: you still need to analyse a lot of samples. that is the reason FFT in most cases is the most efficient, allthough you get a lot of results you might not need…

1 Like

There is a technique called “Zoom FFT” where you shift the frequencies of interest down to near 0 Hz (e.g. with ring modulation) then downsample and use a smaller FFT. Might be more trouble than it’s worth though!

3 Likes

yes, zoom fft is possiblem, but it is more of a lab method, it is not efficient, just super flexible.
for performance, downsampling plus smaller FFT is the way to go.

if you are only interested in bins 100 to 150, you can downsample it 8 times, making the biggest period you need 8 times smaller. You can then take an FFT that is 8 times smaller (256 samples in your case), and you’ll have the same results for way less CPU.
This will be more efficent as doing a DFT by hand.

1 Like

Thanks for the hint!

1 Like

Thank you. FFTW has some information about “pruned fft” but they advise against using these techniques if you need more than 1% of the full spectrum which is clearly my case.
http://www.fftw.org/faq/section3.html#pruned
http://www.fftw.org/pruned.html

As you mentioned before the trade off is the loss of the performance gains through the highly optimizations for fft which are not easily available if you are computing a smaller range.

2 Likes