How to use it
- Enter the sample rate in Hz and the FFT size N.
- Enter a bin number to see its frequency (0 is DC, N/2 is the Nyquist bin).
- Enter the resolution you need to see the smallest frame and the power-of-two FFT size that gives it.
Formulas
- Δf = fs ÷ N
- Frame duration T = N ÷ fs (= 1 ÷ Δf)
- Distinct bins of a real signal: N ÷ 2 + 1
- Frequency of bin k: f_k = k × Δf
- Samples needed for a resolution Δf: N ≥ fs ÷ Δf, then rounded up to a power of two for radix-2 FFTs
Worked example
Audio at 48,000 Hz with a 4096-point FFT:
- resolution: 48000 ÷ 4096 = 11.71875 Hz;
- frame duration: 4096 ÷ 48000 = 85.3333 ms;
- bins from 0 Hz to 24,000 Hz: 4096 ÷ 2 + 1 = 2,049;
- bin 100 is at 1,171.875 Hz;
- for 1 Hz resolution you need 48000 ÷ 1 = 48,000 samples — one second — so the FFT size becomes 65,536, with bins 0.732422 Hz apart.
Tips
- Time vs frequency is a trade-off. A long frame gives sharp frequencies but blurs when things happen; spectrograms usually use 1024–4096 samples for audio.
- Use a window. Multiply the frame by a Hann or Blackman window before the FFT to cut leakage from tones between bins.
- The highest frequency you can see is fs ÷ 2; see the Nyquist calculator for aliasing.