Fourier Synthesis & Signals · Guide · glidepathscience.org
GuideFourier Synthesis & Signals
Contents
This Guide explains the ideas and equations behind every Walkthrough step, Concept Challenge question and Predict round, in the order a textbook would take them. Part 1 prepares the Intro track and Part 2 the Advanced track; each takes about a quarter of an hour to read. Each section ends with a worked example that is not one of the sim’s own problems.
Part 1 · The essentials
Every steady sound is a recipe of sines
Pluck a guitar string, blow across a bottle or say “ah”, and the air near your ear moves back and forth in a pattern that repeats hundreds of times a second. The patterns look nothing alike: a flute’s is nearly a smooth wave, a clarinet’s has square shoulders, a voice’s is a tangle of wiggles. Yet each can be built, as closely as you like, by adding together plain sine waves whose frequencies are whole-number multiples of one lowest frequency. The list of those sines, how strong each one is and how it is shifted in time, is the sound’s spectrum: its recipe.
That one idea, due to Joseph Fourier in the early 1800s, runs through this whole lab. It explains why a square wave and a triangle wave at the same pitch sound different, why two nearly equal notes throb, what a tone control or an equalizer does, and how a phone or a computer can listen to a sound and name its pitch. It also has rules, and the second half of this Guide is about them: how to find the recipe, how fast it must converge, what a sampled recording can and cannot tell you, and where the tidy story breaks.
Pure tones: frequency, period and amplitude
The building block is the pure tone, a single sine wave, $y = A\sin(2πft)$. Three numbers describe it. The frequency $f$ is how many cycles it completes each second, in hertz (Hz). The period $T$ is how long one cycle takes, and since $f$ cycles fill one second,
$f = 1/T$
The amplitude $A$ is how far the wave swings from zero. To the ear, frequency is heard as pitch and amplitude as loudness: doubling the amplitude raises the level by 6 dB but leaves the pitch exactly where it was, because the crests still arrive just as often. The usual slip is to treat the period and the frequency as the same number. A period is a time; a frequency is a rate; one is the reciprocal of the other, and a period in milliseconds turns into a frequency in hertz by dividing it into 1,000.
A pure tone is rare in nature; almost everything you hear is a mixture. The next question is what happens when tones are added.
Adding waves: superposition and harmonics
When two sound waves pass the same point, the air there moves by the sum of what each wave alone would make it do. This is the principle of superposition (OpenStax §16.5): the waves add point by point, instant by instant,
$y = y_1 + y_2$
The sum at a given moment is just the two values added with their signs. It is not the sum of the two amplitudes, which is only how high the sum can ever get when two crests happen to coincide. Where one wave is up and the other down, they partly cancel.
Something special happens when the frequencies are whole-number multiples of one frequency $f_1$: 2$f_1$, 3$f_1$, and so on. These are the harmonics of $f_1$, written $f_n = nf_1$, and $f_1$ itself is the fundamental. In one period of the fundamental, $T = 1/f_1$, the second harmonic completes exactly two cycles and the third exactly three, so at the end of that period every one of them is back where it started together. Their sum therefore repeats with the fundamental’s period, whatever their strengths. Musicians call the harmonics above the fundamental its overtones.
If sums of harmonics make periodic waves, the reverse question is the interesting one: can every periodic wave be written as such a sum, and with which strengths?
Three classic recipes: square, sawtooth and triangle
Fourier’s answer is yes: a periodic wave of period $T$ can be written as a sum of sines and cosines at the harmonics of $f_1 = 1/T$, its Fourier series. For the three waves in this section the cosines vanish and each harmonic is $b_n\sin(2πnf_1t)$ (a pulse train or a rectified sine needs the cosines too). Three shapes show what the recipe tells you about the shape.
A square wave that jumps between +1 and −1 uses only the odd harmonics, with amplitudes that fall as $1/n$:
$b_n = \frac{4}{nπ}$ (odd $n$)
The fundamental, $4/π$ = 1.27, is taller than the square itself; the 3rd harmonic pulls its peak down and its shoulders up, the 5th sharpens the corners further, and so on. The even harmonics are missing because the square is the same shape upside down half a period later, and every even harmonic would break that symmetry.
A sawtooth that falls steadily from +1 to −1 and jumps back once a period uses every harmonic, also falling as $1/n$:
$b_n = \frac{2}{nπ}$
A triangle wave has corners but no jumps, and its odd harmonics fall much faster, as $1/n^2$, with alternating signs:
$|b_n| = \frac{8}{π^2n^2}$ (odd $n$)
The pattern is general. A wave with a jump needs high harmonics to build the sudden step, so its harmonics fall slowly, as $1/n$. A wave whose value is continuous but whose slope jumps at a corner falls as $1/n^2$. The smoother the wave, the faster its recipe dies away and the fewer harmonics it needs. The usual slip is to give every shape the same fall, as if the triangle’s harmonics went as $1/n$ like the square’s.
Once you can read a recipe off a shape, you can also go the other way, and read a shape, or a sound, off its recipe.
Reading a spectrum: pitch and timbre
A spectrum plots each component’s amplitude against its frequency, as a bar or a line. For a periodic sound the lines are evenly spaced at the harmonics $f_1$, 2$f_1$, 3$f_1$…, so the fundamental is both the lowest line and the spacing between lines. More generally, it is the largest frequency that every line is a whole multiple of: that still holds when some lines are missing. Which harmonics are present, and how fast they fall, identify the shape: odd lines falling as $1/n$ are a square; every line falling as $1/n$ a sawtooth.
The ear reads a spectrum too. It hears the pitch at the fundamental, and the relative strengths of the harmonics as the sound’s timbre (OpenStax §17.5), the quality that lets you tell a flute from a clarinet on the same note at the same loudness. The flute-like recipe here is mostly fundamental, with a weaker second harmonic and little above it; a clarinet’s low notes are strong in the odd harmonics and weak in the even ones. (The recipes in this lab are illustrative; real instruments also differ in how their sound starts, wavers and fades.)
The ear finds the pitch from the spacing even when the fundamental itself is missing. A telephone line passes only about 300 to 3,400 Hz, so it removes a man’s voice’s fundamental near 120 Hz entirely, yet the voice does not sound higher: the harmonics that remain are still whole multiples of 120 Hz. This is the missing fundamental, and it is why a small speaker that plays almost nothing at low frequencies can still sound low.
A spectrum of amplitudes leaves one thing out: how the harmonics are lined up in time. That is their phase.
Phase: what changes the shape, and what the ear hears
Each harmonic has, besides its amplitude, a phase: where in its own cycle it is at $t$ = 0. Shifting a harmonic’s phase slides it in time without changing its size. Flip the 3rd, 7th, 11th and 15th harmonics of a square wave upside down (a phase change of 180°) and the square shoulders turn into a spiky, lopsided pattern, yet every bar of the amplitude spectrum stays exactly as tall as before.
What does the ear make of it? For a steady tone at a moderate level, very little: the two versions are hard to tell apart, because the ear mostly analyzes a steady sound into its harmonics’ strengths. That observation, sometimes called Ohm’s acoustic law, has limits, and they belong beside it. Phase can be heard in sharp attacks and clicks, at low fundamentals where the ear can follow individual pulses, in some very spiky waveforms, and over headphones; and in a room the phases arriving at your ear are rearranged by echoes anyway.
In this lab’s sound, every phase is played as drawn: the Builder’s Advanced phase sliders, a filter’s phase shifts and a delay all reach the ear exactly. So you can test the observation above for yourself. Hold the amplitudes fixed, change only the phases, and listen: for a steady tone at a moderate level the difference is small, while the shape changes a lot. That is a statement about steady tones; it does not mean phase can never be heard.
Beats: two tones close together
Two tones whose frequencies are close but not equal drift in and out of step. When their crests coincide the sum is loud; half a beat later one is up while the other is down and they nearly cancel. The result is a tone at the average pitch whose loudness swells and fades: beats (OpenStax §17.6). For two sine waves of equal amplitude, the waves this lab draws and plays, the identity
$y = A\sin(2πf_1t) + A\sin(2πf_2t) = 2A\cos\left(2π\frac{f_2 - f_1}{2}t\right)\sin(2πf_{avg}t)$
shows it: a fast oscillation at $f_{avg} = (f_1 + f_2)/2$ inside a slow envelope. Both sides are 0 at $t$ = 0, as a sum of two sines must be (for two cosines the fast factor would be a cosine too). The slow cosine has frequency $|f_2 - f_1|/2$, but it is loud at both its peaks and its troughs, so the loud moments come twice per cycle of it. The beat frequency is therefore the full difference,
$f_{beat} = |f_2 - f_1|$ $T_{beat} = 1/f_{beat}$
Using the slow cosine’s frequency, half the difference, is the classic mistake; it doubles the beat period. With unequal amplitudes the beats never fall silent: the envelope runs from $|A_1 - A_2|$ to $A_1 + A_2$. Tuning by ear uses beats: as two strings approach the same pitch, the throb slows and finally stops.
Beats come from adding two lines of a spectrum. Filters, the next idea, change the lines themselves.
Filters reshape a spectrum
A tone control, an equalizer, the walls of a room and the RC circuit of the RC Circuit Lab all act as filters: for each frequency they pass a fraction of the amplitude, the gain $|H|$, and shift the phase. A filter that is linear and time-invariant treats each harmonic of a steady input separately, so its output is the input’s recipe with every harmonic multiplied by the gain at that harmonic’s own frequency. A first-order low-pass, the simplest, passes low frequencies and cuts high ones, with
$|H| = 1/\sqrt{1 + (f/f_c)^2}$
where $f_c$ is its cutoff frequency, the point where the gain is $1/\sqrt2$ = 0.707. Well below $f_c$ almost everything passes; well above it the gain falls as $f_c/f$, halving with each doubling of frequency. Sent through a low-pass, a square wave keeps its fundamental and loses its high harmonics most, so its sharp corners round off. A high-pass does the reverse, keeping the edges and losing the slow parts. Two slips are common: using the fundamental’s frequency for every harmonic, and squaring the gain, which gives the fraction of the power that passes.
This is the end of the essentials. Part 2 shows where the recipes come from, and what happens when a computer, rather than an ear, does the listening.
Part 2 · Going further
Orthogonality and the coefficient integrals
How do you find a wave’s recipe? The key fact is that sines and cosines of different harmonics are orthogonal over a period: the average of their product is zero. Over one period $T$, with $ω = 2π/T$,
$\int_0^T \sin(mωt)\sin(nωt)\,dt = \frac{T}{2}δ_{mn}$
where $δ_{mn}$ is 1 when $m = n$ and 0 otherwise; the same holds for cosines, and every sine is orthogonal to every cosine. A product of two different harmonics swings above and below zero equally and cancels; a harmonic times itself is $\sin^2$, which is never negative and averages ½.
Now write the series in full, $f(t) = \frac{a_0}{2} + \sum[a_n\cos(nωt) + b_n\sin(nωt)]$, multiply both sides by $\sin(nωt)$ and integrate over a period. Orthogonality kills every term but one, which leaves
$b_n = \frac{2}{T}\int_0^T f(t)\sin(nωt)\,dt$ $a_n = \frac{2}{T}\int_0^T f(t)\cos(nωt)\,dt$
and $a_0/2$ is the wave’s mean. Each coefficient measures how much the wave looks like that one harmonic. For the ±1 square, $\int_0^{T/2}\sin(nωt)\,dt = (1 - \cos nπ)/(nω)$, which is $2/(nω)$ for odd $n$ and zero for even $n$; the second half-period, where both the square and the sine change sign, adds the same again, giving $b_n = 4/(nπ)$.
The complex form and the two-sided spectrum
Sines and cosines can be packed into complex exponentials with Euler’s formula, $e^{iθ} = \cos θ + i\sin θ$. The series becomes $f(t) = \sum_{n=-∞}^{∞} c_ne^{inωt}$, with
$c_n = (a_n - ib_n)/2$ for $n > 0$, $c_{-n} = c_n^*$, $c_0 = a_0/2$
Each real harmonic becomes two lines, at $+nf_1$ and $-nf_1$, each half as tall: the two-sided spectrum. The magnitude $|c_n|$ is half the harmonic’s amplitude, and the angle of $c_n$ is its phase. A pure sine term sits on the negative imaginary axis, at −90°. The form pays off at once with a delay. Shifting a wave later by $τ$ replaces $t$ by $t - τ$, which multiplies each $c_n$ by $e^{-inωτ}$: every magnitude stays, and harmonic $n$ turns by $-nωτ$, $n$ times as far as the fundamental. That is why a delayed wave has the same amplitude spectrum.
$Δφ_n = -nωτ$
Convergence, the Gibbs overshoot, and smoothness
Does the series really rebuild the wave? For the signals in this lab, which are piecewise smooth with finitely many jumps, the partial sums converge to the wave at every point where it is continuous, and to the midpoint of each jump. But near a jump the convergence has a famous flaw. The partial sums overshoot beside the jump, and as more harmonics are added the overshoot squeezes toward the jump, while its height approaches a nonzero limit rather than zero. The limit is
$\frac{2}{π}\mathrm{Si}(π) = 1.17898$ times the half-jump,
where $\mathrm{Si}(x) = \int_0^x \frac{\sin u}{u}\,du$: an overshoot of 8.95 % of the full jump above its top, the Gibbs phenomenon. For the square through odd $N$ the first peak sits exactly at $ωt = π/(N + 1)$, since the partial sum’s slope is proportional to $\sin((N + 1)ωt)/\sin(ωt)$. Gibbs belongs to jumps only. A triangle never overshoots at all; a rectified sine’s or a smooth wave’s partial sums may overshoot a little at small $N$ (by about 3 % and 5 %), but that dies away as $N$ grows, while at a jump the overshoot approaches a nonzero limit, about 9 %.
Smoothness and decay are tied together. Integrating a series divides harmonic $n$ by $nω$, so integrating a square (jumps, $1/n$) gives a triangle (corners, $1/n^2$), and each further derivative made continuous gains another power of $n$. A wave smooth in every derivative has harmonics that fall faster than any power of $n$, often exponentially. On a decibel scale the difference is plain: $1/n$ falls 6 dB for each doubling of $n$, $1/n^2$ falls 12 dB.
Parseval: power in time, power in harmonics
The mean square of a signal, $\langle f^2\rangle$, is its average power (on the scale where a volt squared is a unit of power), and the square root of it is the rms value. Orthogonality says that when the series is squared and averaged, every cross term between different harmonics averages to zero, so the power is just the sum of the harmonics’ own powers. That is Parseval’s theorem, which holds for any signal whose square has a finite average over a period:
$\langle f^2\rangle = (a_0/2)^2 + \frac12\sum(a_n^2 + b_n^2)$
Each harmonic carries half its amplitude squared, the familiar mean of a sine squared. Parseval makes two calculations easy: the fraction of a wave’s power in its first few harmonics, and the rms error of a partial sum, which is the square root of the power the sum leaves out. Adding amplitudes instead of their squares is the usual slip.
From series to transform
A pulse train, pulses of width $τ$ repeating every $T$, connects the series to the Fourier transform. With the pulses centered on $t$ = 0 and height 1, its mean is the duty $d = τ/T$ and its coefficients are
$a_n = \frac{2}{nπ}\sin(nπd)$
The lines sit every $1/T$, and their heights follow a smooth envelope set by the single pulse, proportional to $\sin(πfτ)/(πf)$, which first reaches zero at $f = 1/τ$. Stretch the period while keeping the pulse and two things happen: the lines crowd closer together, and the envelope keeps its shape (its height falls in proportion to $d$). In the limit of one lonely pulse the lines merge into a continuous spectrum, the transform $F(f) = τ\,\mathrm{sinc}(fτ)$ with $\mathrm{sinc}\,x = \sin(πx)/(πx)$. Periodic signals have line spectra; single events have continuous ones.
Sampling, the Nyquist frequency and aliasing
A computer does not record a wave; it records samples, its values at times $t_m = m/f_s$, where $f_s$ is the sample rate. The highest frequency a sample rate can represent is the Nyquist frequency, $f_s/2$: a tone below it is pinned down by its samples, which is why CD audio samples at 44,100 Hz to keep everything up to 22,050 Hz. A tone above it is not lost, but disguised. Its samples are exactly the samples of a lower tone, its alias, at
$f_{alias} = |f - kf_s|$
with the whole number $k$ that puts the result between 0 and $f_s/2$. Nothing in the samples can tell the two apart. This statement assumes an ideal sampler with no anti-alias filter in front of it, which is what this lab models so that the fold is visible. Real converters put a low-pass filter before the sampler for exactly this reason, removing everything above $f_s/2$ before it can fold down.
The DFT: bins, leakage and windows
The discrete Fourier transform (DFT) turns $M$ samples into a spectrum, $X_k = \sum_{m=0}^{M-1} x_me^{-2πikm/M}$, computed quickly by the fast Fourier transform. It gives amplitudes at $M/2 + 1$ frequencies, the bins, from 0 to $f_s/2$, spaced by
$Δf = f_s/M = 1/T_{rec}$
where $T_{rec} = M/f_s$ is the record’s duration. Resolution is set by how long you listen, not by how fast you sample. A reading names a bin, which stands for every frequency within $±Δf/2$ of its center: an interval, not a point.
The DFT treats the record as one period of a repeating signal. If the record holds a whole number of a tone’s cycles, the repeats join seamlessly and the tone falls in one bin. If not, each join has a jump, and the tone spreads into every bin, falling off slowly: leakage. Its peak also reads low; for the rectangular window (no taper) a tone $δ$ bins from a bin’s center reads about $|\mathrm{sinc}\,δ|$ of its amplitude, worst halfway between two bins. A window tapers the record’s ends before the transform. The Hann window, $w_m = \frac12(1 - \cos(2πm/M))$, makes the joins smooth: its skirts fall far faster and a tone between bins reads much closer to its amplitude, about $\mathrm{sinc}\,δ/(1 - δ^2)$, at the price of a peak twice as wide. Leakage happens only when the record holds a non-integer number of periods; real signals almost never fit, so windows are the norm.
Filters as spectrum multipliers
Part 1 used only a filter’s gain. In full, a linear, time-invariant filter multiplies each frequency by a complex number $H(f)$, a gain and a phase shift. For the first-order low-pass,
$H = \frac{1}{1 + if/f_c}$, $φ = -\arctan(f/f_c)$
Its phase falls from 0 at low frequency, through −45° at $f_c$, toward −90° far above: a low-pass delays. A high-pass, $H = (if/f_c)/(1 + if/f_c)$, has the mirror image, from +90° down to 0. Because each harmonic of a periodic input is multiplied by $H(nf_1)$, the output is again periodic with the same fundamental, but its harmonics are scaled and shifted by different amounts, so its shape changes. Multiplying spectra is the same as convolving in time, the general rule behind every equalizer and every echo. The statement holds in steady state, after the input has run long enough for the filter’s start-up to die away.
Reference
Common mistakes
- Taking the period for the frequency: $f = 1/T$, and a period in milliseconds gives 1,000/$T$ in hertz.
- Adding amplitudes to get the sum at an instant: add the values, with their signs.
- Giving a sum of harmonics the period of its highest tone: it repeats with the fundamental’s period.
- One fall for every shape: jumps give $1/n$, corners $1/n^2$.
- Hearing phase as timbre: in a steady tone the ear follows the amplitudes; phase reshapes the wave.
- Taking half the frequency difference as the beat rate: $f_{beat} = |f_2 - f_1|$.
- Squaring a filter’s gain for the amplitude: $|H|$ is the amplitude’s fraction, $|H|^2$ the power’s.
- Expecting the Gibbs overshoot to vanish with more harmonics: it narrows, but approaches a nonzero limiting overshoot, about 9 % of the jump.
- Forgetting to fold a tone above $f_s/2$: an ideal sampler shows it at $|f - kf_s|$.
- Raising the sample rate to resolve close tones: the bins are $1/T_{rec}$ apart, so record longer.
Equations
| tone | $f = 1/T$ |
| superposition | $y = y_1 + y_2$ |
| harmonics | $f_n = nf_1$, repeat every $T = 1/f_1$ |
| square | $b_n = \frac{4}{nπ}$ (odd $n$) |
| sawtooth | $b_n = \frac{2}{nπ}$ |
| triangle | $|b_n| = \frac{8}{π^2n^2}$ (odd $n$) |
| beats | $f_{beat} = |f_2 - f_1|$, $T_{beat} = 1/f_{beat}$ |
| low-pass gain | $|H| = 1/\sqrt{1 + (f/f_c)^2}$ |
| coefficients | $b_n = \frac{2}{T}\int_0^T f(t)\sin(nωt)\,dt$ |
| complex form | $c_n = (a_n - ib_n)/2$ |
| Parseval | $\langle f^2\rangle = (a_0/2)^2 + \frac12\sum(a_n^2 + b_n^2)$ |
| pulse train | $a_n = \frac{2}{nπ}\sin(nπd)$ |
| alias | $f_{alias} = |f - kf_s|$ |
| bins | $Δf = f_s/M = 1/T_{rec}$ |
| off-center reading | $|\mathrm{sinc}\,δ|$ (rectangular) |
| low-pass phase | $φ = -\arctan(f/f_c)$ |
| delay | $Δφ_n = -nωτ$ |
$f$ frequency (Hz), $T$ period, $f_1$ fundamental, $n$ harmonic number, $a_n$, $b_n$ cosine and sine coefficients, $c_n$ complex coefficient, $ω = 2πf_1$, $d = τ/T$ duty, $f_s$ sample rate, $M$ samples, $T_{rec}$ record length, $Δf$ bin spacing, $δ$ offset in bins, $f_c$ cutoff, $H$ the filter’s response, $τ$ a delay or a pulse width.
Sources and further reading
OpenStax, University Physics Volume 1 (Ling, Sanny and Moebs), §16.5 Interference of Waves and §17.5–17.6 Sources of Musical Sound and Beats, CC BY-NC-SA 4.0: the Intro track’s notation. E. Kreyszig, Advanced Engineering Mathematics (Wiley), for Fourier series and convergence. A. V. Oppenheim and A. S. Willsky, Signals and Systems (Prentice Hall), for sampling and the DFT. F. J. Harris, “On the use of windows for harmonic analysis with the discrete Fourier transform,” Proc. IEEE 66, 51 (1978). G. E. Peterson and H. L. Barney, “Control methods used in a study of the vowels,” J. Acoust. Soc. Am. 24, 175 (1952), for the formants of “ah”. And this lab’s Field Manual (H): how the model works and what it leaves out.
Fourier Synthesis & Signals v1.2 · © 2026 Dr. David Meier · CC BY-NC-SA 4.0 · glidepathscience.org