Signal Generation & DSP·7 min read·

Audio Waveforms Explained: Sine, Square, Triangle, and Sawtooth Harmonics

Discover the harmonic anatomy of synthesis waveforms: Fourier theorem, odd vs even harmonics, phase relationships, and timbre perception.

Safety First: Square and sawtooth waves have high harmonic energy in the upper octaves. Keep headphone volumes low to prevent high-frequency fatigue.

In digital audio synthesis and acoustic testing, periodic waveforms are the atomic building blocks of sound. Every musical instrument, human vowel, or mechanical engine noise can be decomposed into combinations of periodic geometric waves.

Under Fourier’s theorem (1822), any continuous periodic waveform is a sum of sinusoidal waves at integer multiples (harmonics) of a fundamental frequency f0. Which harmonics a shape contains, and how fast they fall away, decides both the timbre you hear and the load a driver sees.


1. The Sine Wave: The Pure Fundamental

A sine wave (y(t) = A × sin(2πft), where A is peak amplitude and f is frequency) contains zero harmonics.

  • Harmonic series: 1 × f0 only.
  • Levels: RMS = A / √2 ≈ 0.707 × A, so the crest factor is 20 × log10(1.414) = 3.01 dB.
  • Timbre: round, smooth, neutral, with no edge or brightness.
  • Uses: calibrating DACs and level meters; total harmonic distortion tests, because any harmonic at the output of a pure-sine test came from the equipment under test (see the THD guide); and audiometric checks, which is why the Frequency Check uses shaped sine tones.

On a driver the sine is the gentle case, so a buzz at high level comes from the driver rather than the signal.


2. The Square Wave: Rich Odd Harmonics

A square wave alternates instantaneously between equal positive and negative voltages, spending 50% of each cycle at peak and 50% at trough. With ω = 2πf0:

x(t) = (4/π) × [ sin(ωt) + (1/3) × sin(3ωt) + (1/5) × sin(5ωt) + (1/7) × sin(7ωt) + … ]

  • Harmonic series: odd harmonics only (f0, 3f0, 5f0, 7f0, …).
  • Amplitude roll-off: 1/n, placing the 3rd harmonic 9.5 dB below the fundamental, the 5th 14.0 dB down and the 7th 16.9 dB down.
  • Levels: an ideal square has a crest factor of 0.00 dB, and its fundamental is 4/π = 1.273 times the wave’s peak.
  • Timbre and uses: hollow, woody and reedy, like a clarinet or an 8-bit game lead. It drives transient, slew-rate and polarity checks, and it stresses tweeters, because a 200 Hz square carries audible energy at 1 kHz, 3 kHz and 5 kHz.

3. The Sawtooth Wave: Full Harmonic Spectrum

The sawtooth wave ramps linearly to peak voltage and drops vertically back in zero time (or the reverse in a reverse ramp). Its asymmetry excites every integer harmonic:

x(t) = (2/π) × [ sin(ωt) − (1/2) × sin(2ωt) + (1/3) × sin(3ωt) − (1/4) × sin(4ωt) + … ]

  • Harmonic series: both even and odd harmonics (f0, 2f0, 3f0, 4f0, …).
  • Amplitude roll-off: 1/n, the same rate as the square, but with twice as many harmonics in any band, so it sounds fuller.
  • Levels: a symmetric ramp has RMS = A / √3 ≈ 0.577 × A, a crest factor of 4.77 dB, and a fundamental at 2/π = 0.637 of the peak.
  • Timbre and uses: bright, buzzy and cutting, the classic character of brass and bowed strings. It is the source in subtractive synthesis, where a resonant filter sculpts the spectrum.

4. The Triangle Wave: Subtle Odd Harmonics

A triangle wave rises and falls linearly at symmetric angles. Like the square it holds only odd harmonics, but its continuous slope makes each successive harmonic fall by an extra factor of n:

x(t) = (8/π²) × [ sin(ωt) − (1/9) × sin(3ωt) + (1/25) × sin(5ωt) − … ]

  • Harmonic series: odd harmonics only (f0, 3f0, 5f0, …).
  • Amplitude roll-off: 1/n², which puts the 3rd harmonic 19.1 dB below the fundamental and the 5th 28.0 dB down, a slope of 12.0 dB per doubling of order.
  • Levels: crest factor 4.77 dB, with the fundamental at 8/π² = 0.811 of the peak, so the shape reads closer to a sine than the square does.
  • Timbre and uses: mellow and breathy, close to a wooden flute. It is the usual low-frequency modulation (LFO) shape for vibrato and tremolo.

5. Harmonic Comparison Summary

The table collects the series, amplitude law and crest factor for all four shapes.

Waveform Harmonic Content Amplitude Law Per-Octave Roll-off Crest Factor Dominant Instrument Quality
Sine f0 only single partial none 3.01 dB (1.414) Pure whistle, tuning fork
Square Odd only (1, 3, 5, …) 1/n −6.0 dB (−12 dB power) 0.00 dB (1.000) Clarinet, chiptune lead
Sawtooth All integers (1, 2, 3, 4, …) 1/n −6.0 dB (−12 dB power) 4.77 dB (1.732) Trumpet, bowed violin, synth lead
Triangle Odd only (1, 3, 5, …) 1/n² −12.0 dB (−24 dB power) 4.77 dB (1.732) Flute, gentle acoustic bass

Crest factor matters twice: for digital headroom, because peaks decide how far the level can rise before clipping, and for the driver, because at equal RMS a square or sawtooth puts more energy into the upper octaves.


6. Where the Shapes Meet the Hardware

The site’s Waveform Generator builds shapes from a rack of 16 harmonic partials rather than from a geometry. Its presets map onto the series above: Square Wave sets odd partials only with 4/(nπ) weights, Triangle uses odd partials with 8/(π²n²) weights, and Sawtooth sets every integer partial with 2/(nπ) weights and alternating signs.

Web Audio compiles those coefficients into a band-limited wavetable, so partials at or above the Nyquist frequency are discarded rather than folded back as aliasing. At 48 kHz, Nyquist is 24 kHz, which fits all 16 partials under a fundamental of about 1.4 kHz; at 2 kHz only partials below the 12th survive. That is why a high square wave looks rounded on an Audio Oscilloscope.


7. Limits, Mistakes and Troubleshooting

Four practical limits decide what you can hear and measure.

  • No digital waveform is the ideal shape. Every edge is band-limited by the converter’s reconstruction filter, the codec, or the driver’s inductance.
  • Silence in the top octave is often not a broken speaker. Bluetooth codecs, phone speakers and laptop drivers roll off above roughly 15 kHz, so a 10 kHz square can arrive stripped of its defining harmonics.
  • Avoid sustained high-level square and sawtooth playback. These shapes concentrate energy where hearing is most sensitive and where a tweeter’s voice coil has the least mass to absorb heat.
  • Use the fixed-wave page for quick tests. The Tone Generator plays the four shapes directly with a frequency dial, dual tones and WAV export.

Academic & Scientific References