React FFT / Spectrogram
A time-domain trace tells you a machine is vibrating. The spectrum tells you at what frequency, which tells you which part. This ships a real radix-2 Cooley–Tukey FFT with selectable windows — switch to the waterfall and a drifting defect tone shows up as a bend rather than a number that changed.
Bearing vibration — spindle 3
256-pt · 50.0 Hz/bin · peak 500Hz @ -0.9 dB
Installation
Props
| Prop | Type | Description |
|---|---|---|
| signal | number[] | Time-domain samples |
| sampleRate | number | Samples per second |
| fftSize | number | Power of two (default 256) |
| defaultView | "spectrum" \ | "waterfall" |
| floorDb | number | Bottom of the dB scale (default -90) |
It is a real FFT
Not a decorative approximation: an in-place iterative radix-2 Cooley–Tukey transform with bit-reversal permutation, verified against known tones — a full-scale 500 Hz sine at 12.8 kSa/s with a 256-point FFT lands in bin 10 at 0.00 dB, exactly where the arithmetic says it should.
Two details that make the numbers trustworthy:
- Window normalisation. Magnitudes are divided by the window's coherent gain, so applying a Hann window doesn't silently cost you 6 dB of amplitude. Switch between Hann, Hamming, and rectangular and a tone's reported level stays put while the skirts change — which is the actual trade you're making.
- Bin resolution is stated, not hidden. The header prints
Hz/bin. With a 256-point FFT at 12.8 kSa/s that is 50 Hz, so the demo's 480 Hz shaft tone reports as 500 Hz — correct behaviour for the resolution, and better shown than smoothed over. RaisefftSizefor finer bins at the cost of time resolution.
The waterfall computes overlapping frames at 50% hop and stacks them newest-last, coloured on the same CVD-safe ramp as Heatmap / Matrix. For the time-domain view of the same capture, pair with Measurement Cursors.
New components every week
Get the week's new Kelvin UI components and templates in one short email. No spam, unsubscribe anytime.