Spectrum analyser
Generate, load, or record a signal and analyse it: waveform, FFT spectrum with window functions and averaging, peak detection, an STFT spectrogram, and THD / THD+N / SINAD for a test tone — plus synthetic ECG, EMG, EEG and PPG with mains hum, baseline wander and noise, and a signal-averaging demo.
Added · updated 14 October 2026
How to use it
-
Signal: build one from components (sine, square, sawtooth, triangle, white or pink noise, a linear chirp) or pick a preset; drop an audio file (WAV is parsed directly at any bit depth — 8/16/24/32-bit PCM or float; MP3, AAC, OGG and FLAC are decoded by the browser); or record a few seconds from the microphone. Play listens to it and Save WAV exports 16-bit mono.
-
Waveform: the shaded box is the analysis frame — click or drag to move it. With averaging on, the whole signal is used.
-
Spectrum: FFT sizes 256–65 536; rectangular, Hann, Hamming, Blackman, Blackman–Harris, and flat-top windows; Welch power averaging over 50 %-overlapped frames; dB or linear amplitude, log or linear frequency. Levels are calibrated so a sine of amplitude A reads 20 log₁₀ A dBFS whatever the window or FFT size. Hover for a readout; the strongest peaks are listed with interpolated frequencies and nearest musical notes. Export as CSV or PNG.
-
Spectrogram: a short-time Fourier transform (75 % overlap) with an adjustable frame and dynamic range, and an optional log-frequency axis. Hover to read time, frequency, and level.
-
THD / SINAD: finds the fundamental (or uses the one you give), integrates power across each window main lobe at harmonics 2–9, and reports THD, THD+N, SINAD, and ENOB. For converter testing, use coherent sampling (an exact bin frequency) with the rectangular window, or a non-coherent tone with Blackman–Harris and a long FFT; the window’s sidelobe floor (about −92 dB for Blackman–Harris) limits what can be measured.
Choosing a window: flat-top gives accurate amplitudes (scalloping loss under 0.02 dB) but wide peaks; Hann and Blackman–Harris resolve close tones; rectangular is right only for coherently sampled or transient signals. Resolution Δf = sample rate / FFT size.
Microphone recording asks for permission and turns off echo cancellation, noise suppression, and auto gain. Audio never leaves the page.
⛶ Full screen (or F) gives the spectrum or the spectrogram, whichever tab is open, the whole screen — the browser’s full screen where it is allowed, otherwise a full-window layer (iPhone); it is redrawn as the window changes. On a wide screen the generator and biosignal panels sit in a column beside it, and ◫ Panels hides them. Escape leaves.
Synthetic biosignals
Educational — not a medical device. Not for diagnosis, treatment, monitoring or dosing. Simulation only: these are toy models — not physiology.
Never connect anything you built to a person. Patient-connected electrical equipment is governed by IEC 60601-1 and its particular standards (leakage current limits, isolation, applied-part classification); bench equipment, development boards and anything with a USB connection to a laptop are not isolated to those limits. If a project needs biosignals, use recorded or synthetic data — like these.
The Synthetic biosignals box generates four signals at the amplitudes and bandwidths the book tabulates (orientation figures, not reference ranges):
| Signal | Amplitude | Bandwidth | Generated as |
|---|---|---|---|
ECG |
~0.5–4 mV |
~0.05–150 Hz |
P, QRS and T waves as Gaussians around each beat (R ≈ 1.2 mV), 1 kHz |
EMG (surface) |
~0.05–5 mV |
~10–500 Hz |
band-limited noise in 1 s contractions every 2 s, 2 kHz |
EEG |
~10–100 µV |
~0.5–100 Hz |
pink-ish background plus a waxing and waning 10 Hz alpha rhythm, 1 kHz |
PPG |
optical (arbitrary units) |
~0.5–20 Hz |
the pulsatile part: a systolic and a dicrotic wave per beat, 500 Hz |
Each gets the three artefacts every biosignal amplifier fights: mains hum at 50 or 60 Hz (with a third harmonic; for the optical PPG it is ambient-light flicker at twice the mains frequency), baseline wander (a 0.25 Hz breathing-rate swing plus slower drift), and white noise. Set them in the signal’s units, or leave a field blank for its default. At the defaults the EEG’s hum is larger than the EEG itself — the book’s point that the signal sits orders of magnitude below the interference. The low sample rates (500 Hz–2 kHz) are added to the generator’s rate list; the spectrum’s log axis then starts at 0.1 Hz, and the dB scale reads dB re 1 mV. Signals sampled below 3 kHz cannot be played by the browser.
Signal averaging
The Signal averaging tab buries a small synthetic evoked response (5 µV by default) in much larger noise (20 µV RMS per trial), repeats it N times, and averages the epochs aligned on the stimulus. It plots one trial, the average and the true response, and the noise left after 1, 2, 4, … trials against the σ/√N line: 100 trials cut independent noise tenfold. This is how evoked-potential systems see a response that is invisible in any single trial.
Companion to chapter 7, “Nerves, sensation, and accessible design” (the biosignal table, the safety boundary, and evoked potentials) and chapter 9, “Circulation, breathing, and the wider body” (ECG and pulse oximetry) of Human Biology for the Medical Maker; amplitudes and bandwidths from its Appendix C, Biosignals.
Limits
The waveforms are shapes for exercising filters, spectra and averaging — not models of a heart, muscle or brain, and not for testing anything that will make a clinical decision. Real recordings differ in morphology, variability, artefacts and noise statistics; averaging assumes noise independent between trials, which real background activity is not. For real data use public, de-identified sets such as PhysioNet.
Sharing
Share link (under the title) copies a URL that reopens this tool exactly as you have it — every tab’s inputs, with the current tab selected. Opening such a link replaces the inputs this browser had saved for the tool.
Related: audio oscilloscope, Fourier series, the eye in dioptres.
Linking to an example
Companion to the Fourier teaser in chapter 13 and the DFT in chapter 15 of
Mathematics, Reconnected. A generated signal and the
analysis settings can be written as parameters, for example
/tools/fft/?sig=sine:220:0.5;sine:440:0.25&fs=8000&scale=lin#spectrum.
Recorded and loaded audio, biosignals and the averaging demo travel only in Share link's compressed ?s=.
| Parameter | Meaning | Example |
|---|---|---|
|
generator components |
|
|
sample rate (500, 1000, 2000, 8000, 16000, 22050, 44100, 48000 or 96000 Hz) and length in seconds |
|
|
FFT size, 256 to 65536 |
|
|
window: |
|
|
amplitude |
|
|
top of the frequency axis in Hz; bottom of the dB axis |
|
|
frames averaged: 1, 4, 16, 64, or 9999 (all) |
|
|
one of the presets below; other parameters override it |
|
Presets:
-
ch13-three-sines— 220, 440 and 660 Hz at amplitudes 0.5, 0.25, 0.125: the FFT finds all three (flat-top window, so the heights read true) -
ch13-synth-square— Odd harmonics of 220 Hz at 1/k: heading for a square wave -
ch13-synth-saw— All eight harmonics of 220 Hz at 1/k: heading for a sawtooth -
ch13-square-wave— A true 220 Hz square wave: odd harmonics falling as 1/k -
ch15-dft-two-cycles— A cosine with 2 cycles every 8 samples (fs/4): one spike, at a quarter of the sample rate
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.