 # dsp::FFT - what is the lowest possible frequency in freq bin zero?

Hello,
I have some strange issues with dsp::FFT. It looks like it’s my wrong interpretation of result frequency range.

I use:
`dsp::FFT::performFrequencyOnlyForwardTransform(float* inputOutputData);`

And I get result in `inputOutputData`.
The main question is what is the lowest possible frequency in bin 0 (I mean `inputOutputData`)

I thought that the lowest frequency bin is equal to:

``````sampleRate / fftSize
``````

But then for really big `fftSize` such as 65536 or higher and for sample rate 44100 Hz I get the lowest freq equal:

``````44100 / 65536 = 0.6729 Hz
``````

which is less than 1 Hz.

It confuses me because many times I’ve heard the lowest reasonable frequency for FFT is 1 Hz.

IIRC the frequency range of an FFT’s output is 0Hz - Nyquist, and the amplitude range will be 0 - number-of-bins.

But then I have problem how to draw it on my chart where Hz are in log scale, so for `log10( 0 Hz )` I get undefined value (actually infinity).

Of course I don’t need to draw 0 Hz, while it always has amplitude zero. So my bin 0 is always zero.

I calc the freq by the formula:

``````nyquistFreq = sampleRate / 2;

for(int bin = 1; bin < fftSize; ++bin)
{
hz = bin * nyquistFreq / fftSize;
x = log10(hz);

...the rest of code...
}
``````

So as you can see I start my loop from bin 1 (not zero), and it is OK but only for big fftSize.
Let’s say I want to show on my chart all frequencies from 20Hz to 20000Hz.
So while
`hz = 1 * nyquistFreq / fftSize;`
is less than 20Hz it is OK.
But the problem start when I have lower fftSize, like let’s say 128. Than all things concern to 20Hz I have in bin zero, then I can’t start my loop from 1. I need to use in some way the bin zero.

But I also can’t start loop from zero, because `log10( 0 )` will give me infinit value.

So I need to rethink it. Have you got any idea how should it be done?

For help great thanks in advance. Best regards.

The value at bin=0 is a special value called DC offset. If your block is well balanced it should yield 0, but it doesn’t have to.

And don’t confuse the nyquist frequency with the samplerate. `Nyquist = sampleRate / 2`, see wikipedia
The formula is
`f (hz) = bin * sampleRate (1/s) / fftSize`
Writing the units helps to catch errors early on.
You can verify your formula on stackexchange