📈

FFT Frequency Analyzer

Configurable Fast Fourier Transform with selectable window functions (Rectangle, Hann, Hamming, Blackman, Blackman-Harris, Flat-top), magnitude & phase display, controllable bin resolution, and real-time peak detection. Educational and measurement-grade — every step is exposed.

100% browser-based — your microphone audio never leaves your device. No recording, no upload.
⏸ FROZEN
Magnitude spectrum · dBFS
Phase spectrum · radians · wrapped (−π to +π)
Bin width (Δf)
FFT size N
Window
Sample rate
Peak frequency
Peak magnitude

Top 5 spectral peaks

# Frequency Magnitude Phase Note
Start listening to detect peaks.

Controls

0 = raw frame-to-frame; higher = more stable but slower transient response.
Window characteristics:

About the FFT & Window Functions

The Fast Fourier Transform (FFT) is the workhorse of audio analysis: it takes a block of N time-domain samples and returns N/2 complex frequency-domain values, each representing the amplitude and phase of one frequency component. The big choice you make every time you run an FFT is the window function — how you shape the time-domain samples before the transform. Picking the right window is half the art of spectral analysis.

Why windows exist (spectral leakage)

The FFT mathematically assumes its input is one period of an infinitely-repeating signal. Real signals don't periodically align to the FFT block boundary, so the FFT sees a discontinuity at the wrap-around point — and that discontinuity smears each true frequency line into a wide skirt of false sidebands. This artifact is called spectral leakage. A window function multiplies the input by a smooth envelope that tapers to zero at the edges, eliminating the discontinuity at the cost of slightly widening the true frequency lobe.

The four key window properties

Every window trades off four characteristics:

  • Main-lobe width — how wide the peak around a single tone is. Narrower = better frequency resolution (you can separate close tones). Rectangle wins; Flat-top loses.
  • Side-lobe rejection — how much the leakage skirts are attenuated. Higher rejection = weak tones aren't hidden by strong ones nearby. Blackman-Harris wins; Rectangle loses.
  • Amplitude accuracy — how accurately the peak height matches the true tone amplitude. Flat-top is engineered for this; others can be off by 1.5 dB depending on where the tone lands relative to bin centers.
  • Coherent gain (CG) — the DC gain of the window. Used to normalize back to true amplitude.

When to use which window

  • Rectangle — never (unless you specifically want the rawest output for debugging or for a signal you know is periodic in the FFT block, e.g., FFT-synthesized tones).
  • Hann — default general-purpose choice. Reasonable side-lobe rejection (-31 dB), moderate main lobe. 90% of real-world FFT work uses Hann or Hamming.
  • Hamming — slightly better near-in side-lobe than Hann but worse far-out. Original telecom standard.
  • Blackman — sharper side-lobe rejection (-58 dB) at the cost of a wider main lobe. Use when weak tones near strong tones matter.
  • Blackman-Harris — extreme rejection (-92 dB) for highly contaminated spectra. Wide main lobe; only use if dynamic range matters more than resolution.
  • Flat-top — for amplitude measurement: peaks match the true tone level to within ~0.01 dB regardless of where the tone falls between bins. Very wide main lobe; useless for resolving close tones.

FFT size and bin resolution

The frequency resolution is Δf = sample_rate / N. At 48 kHz sample rate: N=4096 → 11.72 Hz/bin, N=16384 → 2.93 Hz/bin. Bigger N → finer resolution but more compute (and slower frame rate, since you need to wait longer for a full FFT block). For typical audio work, N=4096 to 8192 is the sweet spot. For very fine pitch work (instrument tuning, room modes below 100 Hz), use N=16384 or larger.

Magnitude and phase

Each FFT bin is a complex number; the magnitude tells you "how much energy is at this frequency", the phase tells you "what timing relationship" each frequency has relative to the start of the FFT block. For most audio work the magnitude is all that matters (since perception is mostly phase-insensitive). Phase shows up when comparing channels (stereo phase coherence), debugging filter group delay, or doing impulse-response measurement. The phase wraps to ±π by default; unwrapping can be useful for inspecting trends but is sensitive to noise.

Frequently Asked Questions

How is this different from the Audio Spectrum Analyzer?
The Audio Spectrum Analyzer uses the Web Audio AnalyserNode, which forces a Blackman window internally and does not expose phase. This FFT Frequency Analyzer pulls raw time-domain samples from the microphone and runs its own radix-2 FFT in JavaScript — so window functions are user-selectable (Rectangle, Hann, Hamming, Blackman, Blackman-Harris, Flat-top), and both magnitude and phase are displayed. It is the more technical / educational tool.
Why is my single tone smeared across many bins?
Two reasons. (1) If the tone's frequency doesn't land exactly on a bin center, energy spreads into neighboring bins — this is "scalloping loss" and is fundamental to FFTs (mitigate it by using a wider window like Flat-top for amplitude or larger N for better bin alignment). (2) The window function itself has a finite main-lobe width — Hann's main lobe is 4 bins wide at -6 dB, Blackman's is 6, Flat-top's can be 10. The smear is the convolution of the true tone with the window's frequency response.
What's "coherent gain" and why is the spectrum normalized?
When you multiply the time-domain signal by a window w[n], the DC gain is reduced by a factor of (1/N) Σ w[n] — for Hann that's 0.5, for Blackman 0.42. To recover the true peak amplitude of a tone you divide the magnitude by this coherent gain. This calculator applies the correction automatically so a 0 dBFS tone reads as 0 dBFS regardless of which window you pick. Without correction, switching windows would shift every dB reading by a few dB just because of the window shape.
Why does the phase look like random noise most of the time?
Phase is only meaningful for bins where the magnitude is substantially above the noise floor. In bins with only background noise, the phase is essentially uniform on ±π. This is normal. Look at the phase plot only at frequencies where you see a clear magnitude peak — that's where the phase value carries useful information about the source signal's timing.
Is the FFT running on the GPU?
No — it's a JavaScript Cooley-Tukey radix-2 implementation running on the main thread, with precomputed twiddle factors. For N ≤ 8192 it comfortably hits real-time (~30–60 fps depending on hardware). For N = 16384 you may see 10–20 fps. A WebGPU or AudioWorklet-based implementation would be much faster but adds complexity; the current implementation is fast enough for typical audio inspection and keeps the code accessible.
Can I use this for FFT-based pitch detection?
Sort of — find the largest peak in the magnitude spectrum, optionally parabolic-interpolate around it for sub-bin precision. But for monophonic pitch detection, autocorrelation or YIN/CREPE give much better accuracy and immunity to harmonics. The Frequency Detector and Pitch Detector tools in the Frequency Detection category use dedicated pitch algorithms and will give cleaner results. This FFT tool is best for spectral analysis, not pitch tracking per se.
What's the difference between "wrapped" and "unwrapped" phase?
Phase is mathematically defined modulo 2π — it's only unique within a 2π range, conventionally −π to +π ("wrapped"). When the true phase progresses past those bounds, it jumps from +π to −π (or vice versa), making the plot look discontinuous. "Unwrapping" detects these jumps and adds 2π to keep the plot continuous, which is useful for inspecting smooth trends like a linear-phase filter's group delay. Unwrapping is sensitive to noise — small phase fluctuations near a wrap point can cause spurious 2π jumps in the unwrapped output.