A triangle wave is the piecewise-linear waveform that rises linearly from −1 to +1, then falls linearly back to −1, repeating each period. Its Fourier spectrum has a specific signature: only odd harmonics, and they decrease as 1/n² — much faster than the square or sawtooth wave's 1/n. That fast roll-off is exactly why triangle waves sound noticeably softer and less buzzy than squares: there's far less high-frequency energy to bother the ear.
The amplitude rule (variable symmetry)
For a triangle wave with symmetry S — the fraction of the period spent on the rising slope — the n-th harmonic's magnitude is |Hn| = 2·|sin(πnS)| / (π² · n² · S · (1−S)). Two key consequences:
- At S = 0.5 (symmetric triangle), sin(πn/2) is zero for every even n, leaving only odd harmonics with the clean 8/(π²n²) coefficient. H1 sits at 8/π² ≈ 0.811, H3 at 8/(9π²) ≈ 0.090 (−19.08 dB), H5 at −27.96 dB, H7 at −33.80 dB — a steep, gentle roll-off.
- Any S ≠ 0.5 breaks the half-wave symmetry, so even harmonics appear. At S = 0.3 the H2 magnitude is already 23% of H1.
- The limits S → 0 (or S → 1) collapse the triangle into a falling (or rising) sawtooth, where the formula converges to 2/(πn) — the well-known sawtooth amplitude envelope with all harmonics present and a slow 1/n decay.
Comparison to square & sine
The toggle overlay puts the textbook analytical shape on the same plot. Three useful comparisons:
- vs Sine — both are smooth (no discontinuities), but a sine has only one harmonic, while a symmetric triangle has the H1, H3, H5… stack. The triangle sounds "almost like" a sine but with a faint buzz from the high-order partials.
- vs Square (50% duty) — same odd-only harmonic set but with 1/n vs 1/n² amplitude rule. The square has H3 at −9.54 dB while triangle has it at −19.08 dB. Square sounds harsh; triangle sounds mellow.
- vs Sawtooth — sawtooth has all harmonics (odd AND even) with 1/n decay. Triangle has only odd with 1/n² decay. Very different timbres.
Why 1/n² instead of 1/n?
The amplitude of a Fourier harmonic for a periodic waveform scales as 1/n raised to (k+1) where k is the order of the lowest-order discontinuity in the waveform. A square wave is discontinuous in its value (k = 0), giving 1/n. A triangle is continuous but its slope is discontinuous (k = 1), giving 1/n². A cubic-spline waveform would give 1/n³, and so on. The smoother the shape, the faster the spectrum falls off.
Why does the triangle look almost like a sine in the comparison overlay?
Because they're spectrally very close. A triangle's H1 contains ~95% of its total energy; everything else is at least 19 dB lower. A sine wave is 100% H1 with everything else literally zero. Visually a 5% perturbation in the waveform shape is hard to spot — the difference is the pointy corners at the peak and trough vs the smooth tops of a sine. Audibly, the triangle's small high-order content adds a subtle reedy quality.
Why does the sawtooth overlay look infinitely sharp while the triangle has ringing?
The dashed-cyan comparison overlays (sine, square, sawtooth) are drawn from their textbook analytical formulas — they have infinite bandwidth and so look mathematically perfect. The green triangle is band-limited to the same harmonic count as the audio engine, so it shows the Gibbs ringing that real digital playback always produces. If you band-limited the comparison overlays the same way, you'd see the sawtooth's vertical drop pick up identical ringing at its discontinuity, and the square's edges round off too. The contrast is intentional — it's "textbook ideal vs what your speaker actually plays".
What happens as I push symmetry to the extremes?
The rising and falling slopes become drastically unequal. At S = 0.1 the wave rises in 10% of the period, then falls slowly over 90% — that's almost a falling sawtooth. The harmonic spectrum fills out: even harmonics emerge, the H1 amplitude shrinks slightly, and the high-order falloff slows from 1/n² toward 1/n. The audible character shifts from soft / pure to brighter / brassier.
Why is the symmetric triangle "perfect" (no even harmonics)?
It has half-wave symmetry: f(t + T/2) = −f(t). Mathematically, this exact symmetry forces every even Fourier coefficient to zero — it's an algebraic identity, not a numerical coincidence. The instant you break that symmetry (S deviating from 0.5), even harmonics pop into existence and grow as the asymmetry grows.
Why does the waveform have rounded peaks instead of sharp corners?
Band-limited reconstruction. The audio engine sums only the first 60 harmonics (or fewer at high fundamentals — capped at Nyquist), so transitions take finite time and the peak corners show small Gibbs-style oscillations. This is what your speaker actually plays — an ideal infinitely-sharp corner is impossible at any finite sample rate.
Is the triangle wave used in real music synthesis?
Yes — extensively. Triangle is the staple "soft lead" or "soft bass" oscillator on virtually every analog synth (Moog, Sequential, Korg, Roland) and most modern digital synths. Its low harmonic content makes it a good starting point for additive synthesis ("triangle plus filter envelope") and FM-style harmonic shaping. Game audio also relies on triangle for "chiptune" lead voices — it's the classic NES pulse-1/triangle channel sound.
Why does the spectrum bar chart show only odd harmonics at S = 50%?
Because the H2, H4, H6 … bars have amplitude exactly zero from the |sin(πn·0.5)| factor in the formula (sin of any integer × π is zero). In the plot they sit at the −80 dB floor (invisible). Drift the symmetry slider just one tick away from 50 and the even bars instantly appear, growing as the symmetry asymmetry deepens.
Can I play a triangle wave at any audible frequency?
The slider caps at 5 kHz to give the 60-harmonic synthesis enough Nyquist headroom (H60 at 5 kHz = 300 kHz; at typical 48 kHz sample rate that's way above 24 kHz Nyquist). The tool reduces the harmonic count automatically as you raise the frequency — by 5 kHz you're effectively hearing just a few harmonics, which is fine: the higher partials are inaudible above ~12-16 kHz anyway.
Is this safe for speakers / ears?
Triangles are gentler than squares but louder than sines. At the default 10% volume they're safe; ramp up gradually. Triangle waves don't carry the brutal high-frequency content that makes squares fatiguing, so longer listening sessions are practical — but the underlying audio hygiene (start low, no extended high-volume listening) still applies.