The mathematics behind the views
From harmonics to a signal
A periodic wave can be built from simple rotations. Change their amplitudes and phases to connect what you see in the waveform, the spectrum, and the phasor view with what you hear.
There are three common parameterizations of a Fourier series. First is amplitude–phase form with A_n and \phi_n:
Using \sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta , each term expands as
so the cosine–sine coefficients are a_n=A_n\sin\phi_n and b_n=A_n\cos\phi_n, yielding
Finally, the same series can be written using complex exponentials e^{i2\pi n t} with coefficients c_n:
where the conversions are c_n=\frac{1}{2}(a_n-i b_n) and c_{-n}=\frac{1}{2}(a_n+i b_n) for n>0.
Display options
The checkboxes below the Waveform plot control scaling, the derivative view, and RMS normalization.
-
Normalize RMS. Rescales the waveform to a target root-mean-square level so that changes in coefficient magnitude do not immediately cause large swings in perceived amplitude. This uses \mathrm{RMS}=\sqrt{\frac{1}{M}\sum_{i=1}^{M} f(t_i)^2} .
-
Auto-scale plot. Automatically scales the main waveform so it fits vertically in the plot area, which makes small-amplitude changes easier to see.
-
Derivative view. Displays the derivative series by transforming coefficients:
a_n' = 2\pi n\,b_nb_n' = -2\pi n\,a_n
Presets: Intuition and Math
Each preset is a standard Fourier series with a specific pattern of harmonic coefficients. These patterns control the smoothness, symmetry, and sharpness of the waveform.
-
Pure tone. A single harmonic produces a sinusoid at one frequency, for example:
f(t)=\sin(2\pi k t) -
Square wave. Odd harmonics only, with amplitudes that decay as A_n=\frac{4}{\pi n} for odd n, and zero for even harmonics.
-
Sawtooth. All harmonics appear with alternating sign:
A_n=\frac{2}{\pi n}(-1)^{n+1} -
Triangle. Odd harmonics only with faster decay, producing a smoother signal:
A_n=\frac{8}{\pi^2 n^2}(-1)^{\frac{n-1}{2}} -
Spike (Dirichlet-ish). Equal-strength harmonics approximate a narrow impulse train, concentrating energy at many frequencies. This uses roughly constant amplitudes, which makes the partial sum resemble a Dirichlet kernel:
f(t)=\sum_{n=1}^{N}\cos(2\pi n t)As N grows, the main lobe narrows while side lobes persist, so the signal looks like a spike repeated once per period.
-
Random phase with decay. Same as clicking Randomize phases in Shape all harmonics: uses the current power-law decay p so that A_n\propto 1/n^p, then randomizes phases to produce a noisy but structured waveform.
Shape the series
These settings shape the entire series before you edit any individual harmonic.
-
Max harmonics (N). Sets how many terms are used in the series. Larger N resolves sharper features but increases complexity.
-
a0. Sets the DC offset a_0/2, shifting the waveform up or down.
-
Time shift t0. Rotates coefficients in phase. The transformed coefficients are:
a_n' = a_n\cos(2\pi n t_0)-b_n\sin(2\pi n t_0)b_n' = a_n\sin(2\pi n t_0)+b_n\cos(2\pi n t_0) -
Even / Odd harmonics. Keeping only even or only odd n isolates symmetry and changes the waveform’s structure.
Partial Sums
Partial sums help visualize convergence and show how the waveform builds as harmonics are added.
-
Show partial sum. Compares the truncated series S_{N_{\text{partial}}}(t) with the full reconstruction.
-
Show convergence ladder. Overlays S_5, S_{10}, S_{20}, S_N to show how the series builds.
Edit a harmonic
You can edit coefficients directly or via amplitude and phase.
-
a/b mode. Directly edit a_n and b_n.
-
A/φ mode. Edit amplitude and phase where:
A_n=\sqrt{a_n^2+b_n^2}\phi_n=\operatorname{atan2}(a_n,b_n) -
Harmonic selector. Chooses which n you are editing at a time.
Shape all harmonics
These tools modify all harmonics at once to shape the spectrum quickly.
-
Power-law decay. Sets A_n\propto 1/n^p across all harmonics.
-
Randomize phases. Uses the current Power-law decay p to set each amplitude to A_n = 1/n^p, then assigns a random phase \phi_n in [-\pi,\pi] to each harmonic. The teal amplitude bars follow the decay you chose, while the violet phase bars show the randomized phases. Use the decay slider above to control how amplitudes fall off before clicking.
-
Low-pass, band-pass, high-pass. Zero coefficients outside the selected band to sculpt the spectrum. The app uses fixed bands based on the current N:
\text{Low: } 1\le n\le \lfloor N/3 \rfloor\text{Band: } \lfloor N/3 \rfloor < n \le \lfloor 2N/3 \rfloor\text{High: } n > \lfloor 2N/3 \rfloor
Sound controls
The top toolbar lets you hear the current Fourier series as a periodic sound. The shape of the waveform (and thus the timbre) is completely determined by your set of amplitudes A_n and phases \phi_n; nothing in the audio bar changes that shape.
-
Play sound / Stop sound. Click Play sound to start playback of the waveform defined by your current coefficients. The same series you see in the Waveform plot is sent to the Web Audio API as a periodic wave: the harmonic coefficients a_n and b_n (after any time shift) are used to build the sound. The button toggles to Stop sound; click again to stop playback. Changing coefficients, presets, or sliders updates the sound in real time while it is playing.
-
Pitch (Hz). The fundamental frequency in hertz: how many times per second that one-period shape is repeated. It does not change A_n or \phi_n; it only sets the pitch. The period is 1/f_0 seconds, so higher f_0 means a higher note. Harmonic n is played at n f_0 Hz.
-
Volume. Master gain for playback (0–1). Does not change the waveform shape, only its loudness.
-
Remove DC. When checked, the DC term a_0/2 is set to zero in the audio output. This avoids a constant offset in the signal, which can cause clicks when starting/stopping or unwanted low-frequency rumble. The Waveform plot still shows the full series including DC.
Motion and measurements
The Pause motion button freezes both the rotating phasors and the animated partial sums without stopping sound. Play motion resumes them. Motion starts paused when your system requests reduced motion.
The readouts above the plots show the harmonic limit, the number of nonzero harmonics, and the RMS of the plotted signal. In Build the wave, the Terms counter shows how many harmonics are currently included. Use One series, three forms to read the coefficients in sine–cosine, amplitude–phase, or complex notation.