2
$\begingroup$

I'm working with audio data analysis through FFT algorithm. My example audio is a sine wave at 440 Hz and 44100 Hz sampling rate.

FFT methods in programming, like scipy.fft(y), require a vector of samples and a number of points/samples to analyze. Sample rate is used to determine the width of each frequency range/bin in the resulting data vector (FS/N).

I've read that to increase frequency resolution of FFT results one should dicrease sampling rate and increase window size (number of samples).

I understand that I can change the N value (samples count) that I pass to the algorithm.

But if the audio is at 44100 Hz how can I dicrease it?
Would the resulting frequency bands reflect incorrect information about magnitudes of the FFT data?

Or should I change the input audio data somehow (manipulating directly the samples in the vector) before FFT so the data is passed with lower rate (say at 22050 Hz)?

Thanks.

$\endgroup$
2
$\begingroup$

I've read that to increase frequency resolution of FFT results one should dicrease sampling rate and increase window size (number of samples).

To increase frequency resolution, you increase the window size (increase the number of samples). The sample rate does not change.

For simplicity, I'll pretend your signal is sampled at 800 Hz.

If you were to take 4 samples of the audio, and run an FFT on it, you would get 4 samples in the frequency domain. They would represent 4 frequency bins:

[0 Hz (DC), 200 Hz, ±400 Hz (Nyquist), -200 Hz]

Each of these bins is 200 Hz wide. If instead, you had taken 8 samples of the audio, and run an FFT on it, you would get 8 samples in the frequency domain, representing 8 frequency bins:

[0, +100, +200, +300, ±400, -300, -200, -100]

Each of these bins is 100 Hz wide. Does that make sense? So to get narrower bins, you need to take more samples of your audio. But the maximum frequency in the FFT (the Nyquist frequency of ±400 Hz) does not change; it's the same regardless of the number of samples.

Note that you can get these values like this:

scipy.fftpack.fftfreq(4, 1/800)
Out[8]: array([   0.,  200., -400., -200.])

scipy.fftpack.fftfreq(8, 1/800)
Out[9]: array([   0.,  100.,  200.,  300., -400., -300., -200., -100.])
$\endgroup$
0
$\begingroup$

If you down-sample your data to a lower sample rate (after proper bandlimiting and/or low-pass filtering, etc.), then the duration or time covered by the same number of samples at the new lower sample rate will increase, thus allowing more frequency resolution in terms of FFT bin spacing (for an FFT of the same vector length in samples as prior to down-sampling).

$\endgroup$
0
$\begingroup$

There are 2 different things here that we are mixing:

  1. Bin Width
    As you mentioned, the bin width is a function of the ratio between the sampling rate and the number of samples. If you increase the number of samples and keep sampling rate constant or reduce the sampling rate while keeping the number of samples you can get smaller width of the bin of the DFT.

  2. Resolution
    Resolution is the ability to observe 2 different single tones (With similar energy) in the DFT. This is basically limited by the main lobe width of the interpolation kernel of the DFT (For rectangle windows, which have the best resolution, this the Dirichlet Kernel / Discrete Sinc Function) This is a function of the Observation Time (I'm talking about classic DFT here). Namely to have better resolution you need more samples at the same sampling rate.

Namely in reality, the best way is having more data, which in most cases there is not.

So in your case the real question is, what do you need?

If you just want bins which are denser in the DFT you can do Zero Padding.
If you just want to decrease the Sampling Rate of the data, apply Low Pass Filter and Decimation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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