How can sine waves add up to make a square wave?
Add a sine at the note's pitch, then sines at three, five, seven, and more times the pitch, each one quieter in proportion. The bumps cancel in the middle and pile up at the edges until the sum looks square. Every repeating sound can be built this way, which is how synthesizers and your ear make sense of timbre.
- Highest harmonic used
- 2
- Overshoot at the jumps
- 0%
- Peak of the sum (ideal is 1)
- ×0.827
Challenge: Add 30 or more sines to a square wave and see that the overshoot never drops below 8%.
More settings
Play
Start at 1 sine and slide up. Press "Add them one at a time" to hear the tone get brighter.
Challenge: Add 30 or more sines to a square wave and see that the overshoot never drops below 8%. The box under the picture turns green when you get it.
Stuck? Pick one of the examples from the “Try an example” menu, or press “New example.”
Understand
Any repeating wave can be written as a sum of sines at whole-number multiples of its pitch, a Fourier series. For a square wave the recipe is the odd harmonics, each as strong:
The top graph shows the sum against the ideal wave. The bars show each harmonic's strength, the same picture a spectrum analyzer draws. Try the sawtooth (every harmonic) and the triangle (odd ones, fading as ) to see how the recipe sets the shape and the sound.
Use
Every input has a unit menu, so you can type values in the units you already have. Results follow your units.
Show the work
- The recipe for a sawtooth wave: every harmonic, each 1/n as loud
x(t) = \frac{2}{\pi}\sum_{n=1}^{2} (-1)^{n+1}\frac{\sin(n\omega t)}{n} - The first few terms
0.637\sin(1\omega t) - 0.318\sin(2\omega t) - With a pitch of 220 Hz, the highest sine is
2 \times 220 = 440\ \text{Hz}
Export
Pick a target shape and slide the number of sines. The sound buttons play your sum, build it up one stage at a time, and compare it with the ideal wave.
- Synthesizer oscillators are band-limited: they stop below the top of hearing to avoid aliasing, so they are also finite sums like this.
For learning and estimation. Verify with applicable codes, standards, and a qualified professional before using in design, construction, or safety-critical work.
Cheat card
| Symbol | Meaning | Unit |
|---|---|---|
| harmonic number | ||
| angular frequency, 2π × pitch | rad/s |
- Odd harmonics only gives the hollow sound of a clarinet or a square-wave synth.
- A 1/n² falloff fades the high harmonics fast, which is why a triangle wave sounds soft.
- The sharper the corners in a wave, the more high harmonics it needs, and the brighter it sounds.
Where it’s used
- Music & Sound
Additive synthesizers and organ drawbars build tones by mixing harmonics at chosen strengths. - Electrical & Electronics
Engineers use Fourier series to see which frequencies a digital clock signal will radiate. - Music
A clarinet sounds hollow because its tube favors odd harmonics, like a square wave.
Related exhibits
- Start here
Sine waves: wall power and musical notes
The outlet and a tuning fork follow the same curve: amplitude, frequency, and phase.
- Go further
The tone knob is a filter: an RC low-pass
A resistor and a capacitor set a cutoff at 1 ÷ (2πRC). Above it, every octave gets 6 dB quieter, and the sound turns dark.
- Also try
Why a distortion pedal changes the sound: polynomials make harmonics
Push a pure note through a curve like x − x³/3 and new notes appear. The cube is where the extra harmonics come from.
- Also try
The harmonic series: the chord hiding inside every note
Every note also rings at 2, 3, 4, 5 … times its frequency. Those overtones spell out octaves, fifths, and a whole dominant 7th chord.
- Also try
Euclidean rhythms: world grooves from one rule
Spread a few hits over a bar as evenly as you can. That one rule rebuilds the tresillo, the bossa nova, and the West African bell.
Questions people ask
Why does a square wave need odd harmonics only?
A square wave looks the same flipped upside down half a period later. Even harmonics would break that symmetry, so their amounts come out to zero.
What is the Gibbs ripple?
Right next to each jump, the sum overshoots by about 9% of the jump. Adding more sines squeezes the ripple closer to the jump but never shrinks its height.
Is this how real instruments work?
Every steady musical tone is a sum of harmonics, and the mix of strengths is its timbre. Real instruments also change the mix over time, especially at the start of a note.
Updated : First published.