Studio 02 · Analysis
See what a signal
is made of.
Two sine tones and a noise floor, sampled at 48 kHz and transformed by an in-page radix-2 FFT. Change the window, the frame length and the noise, and watch the peak, the noise floor, the SNR and the −3 dB bandwidth move with the spectrum and the scrolling spectrogram.
- 512 · 1024 · 2048 · 4096
- Rectangular · Hann · Hamming
- Peak interpolation · SNR · −3 dB BW
- Scrolling spectrogram
- spectrum
- peak
- noise floor
Method
From samples to numbers
Each frame holds N samples of x[n] = A₁sin(2πf₁n/fs) + A₂sin(2πf₂n/fs + 0.7) + σ·g[n], where g is a deterministic Gaussian sequence so that two runs of the same settings give the same picture. The frame is multiplied by the window w[n], then transformed with an iterative radix-2 Cooley–Tukey FFT: bit-reversal permutation, log₂N stages, N/2 butterflies each.
Single-sided magnitudes are scaled by 2/Σw so that a bin-centred sine of amplitude A reads A·(coherent gain) in linear terms, and converted to dBFS. The peak is the largest bin below Nyquist refined by a parabola through its two neighbours — with N = 2048 at 48 kHz the raw bin spacing is 23.4 Hz, and the interpolation typically lands within a few hertz of the true tone.
The noise floor is the median bin level of the frame. Because the magnitudes of Gaussian noise are Rayleigh-distributed, that median sits 0.54 dB below the mean, so it is corrected before it is spread over all bins to give the noise power. SNR then compares the tone power in the ±3 bins around each peak with that noise power, which is why the readout falls one decibel for every decibel of added noise instead of saturating on the window's leakage skirt. The −3 dB bandwidth walks out from the peak bin while the power stays above half the peak.
Formulas
Resolution and windows
| Quantity | Relation | Effect here |
|---|---|---|
| Bin width | Δf = fs/N | 93.8 · 46.9 · 23.4 · 11.7 Hz |
| Frame length | T = N/fs | 10.7 · 21.3 · 42.7 · 85.3 ms |
| Hann window | w = 0.5 − 0.5cos(2πn/N) | −31.5 dB side lobes |
| Hamming window | w = 0.54 − 0.46cos(2πn/N) | −43 dB first side lobe |
| Parabolic peak | δ = ½(y₋₁−y₊₁)/(y₋₁−2y₀+y₊₁) | Sub-bin peak estimate |
Rectangular windows resolve close tones best but leak badly; Hann trades about one bin of resolution for side lobes 31 dB lower. Set the two tones 30 Hz apart at N = 4096 and switch windows to see the trade directly.
Guides