0
$\begingroup$

I wish to do the FFT of streaming audio data coming into a computer. I am just interested in frequencies from 80 Hz up to 1000 Hz but with a frequency resolution of 3 to 4 Hz and no more.

Basically my question is , as my sampling frequency (Fs) is 44100, will my FFT window size have to be no less than 11025 (N) ? (because spacing of FFT bins = Fs/N). Does this mean that I am completely limited to taking windows of data any higher than 4 times a second with my desired resolution.

Unfortunately I need to be able to capture windows of data 8 times a second and also have a resolution of 3 to 4 Hz.

Is this actually possible? Many thanks in advance.

$\endgroup$
7
  • $\begingroup$ Can your windows not overlap? $\endgroup$ Commented Apr 11, 2016 at 15:58
  • $\begingroup$ What do you mean exactly? $\endgroup$ Commented Apr 11, 2016 at 19:03
  • $\begingroup$ If you want the DFT to have that resolution, then, yes, you will have to use 11025 data samples (this does not include zeropadding, which does not improve resolution but often helps by decreasing the frequency sample spacing). However, if you can overlap your windows, then you can still get 8 per second. For instance, use samples 0-11024 on the first one and then 5512-16536 on the second one. The data in the separate windows will not be independent anymore, but I don't know if that matters to you. $\endgroup$ Commented Apr 11, 2016 at 20:05
  • $\begingroup$ I'm looking for note changes from a violin at around 8 times a second. If the windows will be overlapped, i'm not sure if this will be an issue. Why won't padding zeros to windows of size 5512 samples to increase the sizes to 11025 not work? Isn't decreasing the frequency sample spacing the same as increasing the frequency resolution? Btw, thanks alot for your replies $\endgroup$ Commented Apr 12, 2016 at 14:06
  • $\begingroup$ For violin sounds, you need to find a pitch detection/estimation algorithm. An FFT frequency estimator will often give you wrong results because musical pitch is different from spectral frequency, especially with stringed instruments. $\endgroup$
    – hotpaw2
    Commented Apr 12, 2016 at 15:11

2 Answers 2

1
$\begingroup$

The FFT size can be longer than the window size. For instance you can use audio sample windows of 5512 (about 8 per second) and zero-pad them to length 16384 for each FFT. If noise level is low enough and the separation between frequency peaks is great enough, the interpolation provided by this zero-padding can provide better frequency estimation and plot resolution.

The "highest resolution" FFT reasonable depends on the signal-to-noise ratio as well as the window length, as after a certain point, interpolation and frequency estimation methods will be affected as much by nearby spectral noise as by the spectral peaks that one is trying to estimate at "high resolution".

$\endgroup$
-1
$\begingroup$

You can zero pad your "windows" of data to increase the frequency resolution. to get 3-4 Hz resolution, you would need to take a 16384 point FFT (gets you about 2.5Hz resolution). you could then take 1/8th of your sampling rate in samples (5513 samples) and add zeros to the end until you get 16384 samples. By taking the FFT of this, new block with zeros at the end, you still get a 16384 point FFT, which gives you the frequency resolution you need, but still be able do your fft 8 times a second.

Please note that you need a number of samples that is a power of 2 to do an FFT, If you are doing the fft in matlab, i believe it will add zeros to the end of your signal if you don't give it enough samples. If you can get by with a resolution of 5.4Hz, then you can do a 8192 point FFT.

$\endgroup$
3
  • $\begingroup$ I'm actually doing this in java code. I was taking windows of 11025 samples of audio data from the sound card. The sample rate of the sound card being 44100 , so 11025 samples taking 250 ms of data. My FFT size is not a power of 2. Is this a problem? $\endgroup$ Commented Apr 11, 2016 at 19:10
  • $\begingroup$ Zeropadding will decrease the sample spacing but will not improve resolution. Neither does the vector size need to be a power of 2. There are several efficient implementations that do not have this requirement (e.g. FFTW ). $\endgroup$ Commented Apr 11, 2016 at 19:57
  • $\begingroup$ @Engineer999 I guess there are algorithms that don't need powers of 2, but if you just want to use your standard FFT library, but with a non-power of 2 sample size, then you can just fill in the back with zeros and you should get a good result. You should be fine with taking half of that 11025 (making it 125mS) and do the FFT as I've described it and that should work for you. $\endgroup$ Commented Apr 12, 2016 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.