1D FFT Paint Lab

Paint a signal in time, watch the spectrum update live. Mask frequencies and the reconstruction redraws instantly. Hover the spectrum to see the pure sinusoid each bin represents.

1. Signal x(t)

Left-drag to draw · right-drag (or shift-drag) erases to zero · hold ⌥/Alt to add to the existing signal

signal x[n] N = 256

2. Magnitude spectrum |X(k)|

DC on the left, Nyquist on the right · hover any bar to see the sinusoid basis at that frequency

hover a frequency bin…

3. Frequency mask (paint to kill)

Left-drag kills · right-drag (or shift) restores · resets reflect in the spectrum and reconstruction below

4. Reconstruction (inverse FFT)

The signal you get back from the masked spectrum · compare with the original

original reconstructed hovered basis
What does each panel teach?

Signal pad. A discrete real-valued sequence x[n] of length N = 256. Index n is time (or position along a 1-D line). Amplitude on the y-axis is in [-1, +1] (and gets clipped to that range visually but values keep their sign).

Magnitude spectrum. |X[k]| for k = 0..N/2. Bin k corresponds to frequency k/N cycles per sample. k = 0 is DC (the mean); k = N/2 is the Nyquist frequency (alternating ±1). For a real signal the negative-frequency half is the complex conjugate of the positive half, so we just show k = 0..N/2.

Hover to inspect. Hovering bin k draws (in purple) the pure cosine basis function cos(2π k n / N) scaled by the magnitude. This is exactly what that bin contributes to the reconstruction. The phase of X[k] decides whether it's a cos, a sin, or somewhere in between.

Mask. Painting on the spectrum sets the corresponding X[k] (both magnitude and phase) to zero. This is the same operation as setting frequencies to zero in an image-processing low-pass / band-pass filter — only here in 1-D.

Reconstruction. Inverse FFT of the masked spectrum. RMS error is computed against the original. Try: drawing a sharp square wave then low-passing it — you see Gibbs ringing. Or drawing a constant + low sinusoid, then notching DC — the constant disappears.

Things to try: