← Back to projects

Spectrogram Lab — Anomaly Detector

Generate audio signals, visualize their spectrograms in real-time, and detect anomalies using statistical thresholding — all powered by the Web Audio API.

JavaScript Web Audio API Canvas 2D FFT Analysis

How It Works

The demo uses the Web Audio API to generate or capture audio, then performs FFT analysis to compute the frequency spectrum. The scrolling spectrogram uses an inferno-style color map. Anomalies are detected when spectral energy exceeds 2 standard deviations above the running mean.

ControlAction
Synth modeGenerate audio with adjustable frequency, amplitude, noise, and harmonics
Mic modeCapture live audio from your microphone
Inject AnomalyAdd a random transient burst (click, screech, or noise)
Frequency bandFocus detection on Low, Mid, High, or All frequencies

The Concept

In industrial settings, acoustic anomaly detection identifies faulty equipment by analyzing sound patterns. Normal operating sounds have consistent spectral signatures, while anomalies (grinding, clicking, rattling) produce distinctive frequency spikes that statistical or deep learning models can flag automatically.