# Jack buffer size and FFT frequency resolution

In my actual Jack Audio setup (almost default values), Fs = 48kHz the buffer size is 1024 samples.

I'm planning to do some filtering (lowpass, highpas, ...) and choose to use FFT.

Had done some reading and found that the frequency resolution is $Fs \over n$ so in that case the frequency resolution will be

$${Fs \over n} = {48000 \over 1024} = 46,875$$

Which is a high value and well imprecise value do deal with it.

What if want do 60Hz highpass filtering ? (c[0][1] = 46Hz, c[0][2] = 92Hz c is complex returned from fft function.)

Some details:

I have choose FFT because i think more simple to do such simple things, but i'm a really beginner in the DSP field this can be false.

Ps: In jack you register a callback and it gets called when there's data to be processed, with a buffer and it's buffer size (fixed).

As a general rule which is easy to remember: The frequency-domain resolution of a FFT does only depend on the time-duration of your signal (this rule also works when you do zero-padding of your signal). The resolution is always given by $1/T$, where $T$ is the duration of your FFT window in seconds. So, in your case your frequency domain resolution will be $1/(1024/48000)=46.875\text{Hz}$ as you have pointed out. Hence, if you want to get better frequency resolution with an FFT, you need to have longer FFT windows. You can use zero-padding to reduce the frequency bin distance, but this will not buy you more frequency resolution. You can have a look at this article I wrote about FFT resolutions, zero-padding and other effects.

However, note that you should not use the FFT to perform filtering of a streaming signal: reference 1 reference 2. Instead, you should perform time-domain filtering with a FIR or IIR lowpass filter. Then you have less delay and would also not need to concern about frequency domain resolution. Let me know, if you need an example on how to design such filter in Python.

• The Python example will be very helpful. – Victor Aurélio Mar 10 '17 at 17:17
• The JAMin software apparently uses FFT, as in preferences there's a option to choose between FFT and IIR crossover, and its linked against libfftw. So whats it is doing? – Victor Aurélio Mar 10 '17 at 17:49
• FFTs can be used for FIR filtering by using overlap-add/save processing (but certainly not by just zeroing bins!). For long FIR filters, the FFT method is often faster. – hotpaw2 Mar 10 '17 at 21:59
• In the article, it seems the equation for the frequency bin width is incorrect (seems like it'd be 'T', not 'Ts')? The distance between frequency bins Δf of the DFT output only depends on the length of the input sequence T and is given by Δf=1/Ts. The distance between frequency bins does not depend on the sampling frequency. – Mark LeMoine Jun 28 at 7:43

Don't filter in the frequency domain for what you're trying to do! Write a filtering routine that uses coefficients you can calculate with:

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt