# How can I decide proper FFT length(size)?

I'm trying to understand about deciding FFT length(size) and relative factors.

what If I got the streaming adc data as the below,

1624
20850
10314
-15042
-18908
3717
21175
8479
-16411
-17907
5796
21308
6493
-17713
-16662
7687
21241
4468
-18724
-15291
9750
20929
2392
-19649
-13833
11508
...


Q1. My first question is from here, I want to process with FFT but I don't know how do we decide proper FFT length (size)?

Q2. If I just decide to use FFT8, then can I use FFT8? or if I want to use FFT8 then what should I have to consider what I need to know? As I know (I'm slowly studying DSP) FFT8's number of inputs are 8. then FFT8 is working as

First term inputs
1624
20850
10314
-15042      =>       FFT out
-18908
3717
21175
8479

Second term inputs
-16411
-17907
5796
21308           =>       FFT out
6493
-17713
-16662
7687

Third term inputs
21241
4468
-18724
-15291          =>       FFT out
9750
20929
2392
-19649

n terms inputs
-13833
11508
...


is this right?

I've read some articles https://electronics.stackexchange.com/questions/12407/what-is-the-relation-between-fft-length-and-frequency-resolution https://spectraplus.com/DT_help/fft_size.htm But I didn't get it exactly.

So Would you help me to undersatnd how does FFT size decide and calculate process?

Q3, From http://support.ircam.fr/docs/AudioSculpt/3.0/co/FFT%20Size.html, What does 21,53 Hz. mean? As their description below.

Reminder : Bins The FFT size defines the number of bins used for dividing the window into equal strips, or bins. Hence, a bin is a spectrum sample, and defines the frequency resolution of the window.

By default :

N (Bins) = FFT Size/2

FR = Fmax/N(Bins)

For a 44100 sampling rate, we have a 22050 Hz band. With a 1024 FFT size, we divide this band into 512 bins.

FR = 22050/1024 ≃ 21,53 Hz.

But I want to know more about 21,53 Hz. exactly FR.

But I want to know more about 21,53 Hz. exactly FR.

This represents the bandwidth (how wide in Hz a bin is) of a particular bin. The smaller this value is, the better FR you have. In order to get the bin center frequency, you can use the following formula

bin_center_freq = FR * bin_number;


So, for, say, bin at index 20 , we get

bin_center_freq =   21,53*20 = 430,66 Hz (Note that the bin at index 0 represents DC (0 Hz)


When we have a bin center frequency, we can easily calculate the lower and upper frequencies for that bin.

bin_lower_freq = bin_center_freq-(FR/2) = 419,89 Hz

and

bin_upper_frequency = bin_center_freq-(FR/2) = 441,42 Hz


Note that the real frequency resolution (our ability to separate close-by frequencies) will still depend on the type of the window used for the FFT (Blackman, Gaussian, Hamming, rectangular etc) as well as on the spectral content present (whether we have components that are both close in frequency and amplitude etc) in the signal so you shouldn't assume that a particular bin contains only frequencies belonging to that bin(due to the spectral leakage, every bin will also have energy contributions from neighbouring bins).

So, what is the right FFT size?

It really depends on what you want to do with your signal. If you have a signal containing 2 sine waves close in frequency and amplitude (e.g. one 220 Hz, and the other 225Hz), you should choose a relatively long FFT length such that the FR is less then 5 (f1-f2). But since windowing also affects the result, make your FFT length even longer to compensate for the windowing effect. You can read up more on window functions here ( https://en.wikipedia.org/wiki/Window_function )

• FR is computed by dividing the sampling rate by the FFT length, so having larger FFT lengths will increase FR but if we define the real frequency resolution as the ability of a system to separate close-by frequencies (having similar amplitudes), then the choice of the window used (or no window at all, which corresponds to a rectangular window) will also affect our results. – dsp_user Feb 5 '18 at 11:05
• According to your recommend, should I have to use long FFT size as I can as ? – start01 Feb 5 '18 at 14:01
• Yes, longer FFTs lengths will give you better FFT resolution (if you keep the sampling rate unchanged). If you have some a priori knowledge of the signal in question, then it's possible to use even smaller FFT sizes. – dsp_user Feb 5 '18 at 14:17
• What does some a priori knowledge of the signal mean? – start01 Feb 5 '18 at 14:37
• It simply means that you already know something (or a lot) about the signal in question (before actually analyzing it). – dsp_user Feb 5 '18 at 14:47