A few frequencies already rebuild the signal (the idea behind JPEG/MP3 compression). The square wave shows the Gibbs ringing. The FFT is the basis of audio processing and image analysis.
The big idea: every signal can be written as a sum of simple waves (sines and cosines), each with its own frequency (how many times it oscillates), amplitude (how much it weighs) and phase (where it starts). Add enough of them and you can rebuild any shape: a square wave, a musical note, a heartbeat…
This tool does exactly that with a DFT (Discrete Fourier Transform): it takes a signal of 128 samples and computes how much of each frequency it contains. Everything runs in your browser, with no server.
The same signal is drawn in two ways:
• Time domain — the “Signal (time)” plot: the value of the signal instant by instant, left to right. This is how you usually see it.
• Frequency domain — the “Spectrum” plot: which frequencies make it up and how strongly, regardless of their order in time.
The DFT takes you from the first to the second; no information is lost: they are the same signal described in other words. Many things (filtering noise, compressing, detecting tones) are far easier to see in the frequency domain.
1. Pick a signal shape with the buttons (Sine, Square, Sawtooth, Pulses, Chirp).
2. Move Frequency (from 1 to 8) so it oscillates more or fewer times.
3. Look at the Spectrum below: each bar is a frequency; the height is its magnitude.
4. Raise k frequencies (from 1 to 40) and watch the reconstruction line over the signal: with more k it looks more like the original.
Everything recomputes instantly; the Reset button returns to the defaults (Square, frequency 3, k = 6).
Each shape has a very different spectrum, and that is the point:
• Sine — a single pure frequency: sin(2π·f·t). In the spectrum it shows up as a single bar.
• Square — jumps between +1 and −1. It needs infinitely many odd harmonics: that is why the spectrum has many bars that fade away.
• Sawtooth — ramps up and drops suddenly; rich in harmonics.
• Pulses — a short spike that repeats; its spectrum is very wide.
• Chirp — a sine whose frequency rises over time (sin(2π·(f·t + 6·t²))), like a sweep or a bird's song.
The spectrum shows the magnitude of each frequency (the first 64 are drawn, the useful half of the 128). A tall bar on the left = a strong low frequency; bars on the right = fine detail and edges.
The k frequencies control keeps only the k tallest bars and rebuilds the signal from them (inverse transform). With very few it already approximates the original: that is the idea behind lossy compression (JPEG, MP3), which throws away the frequencies that barely weigh. On the square wave you will see the Gibbs ringing: little ripples at the jumps that do not go away no matter how high you push k.
A few frequencies already rebuild the signal (the idea behind JPEG/MP3 compression). The square wave shows the Gibbs ringing. The FFT is the basis of audio processing and image analysis.