Explore how complex musical tones are built from simple sine waves. Additive synthesis lets you stack harmonic partials at integer multiples of a fundamental frequency, controlling each partial's amplitude and exponential decay to sculpt timbre in real time.
y(t) = Σ Aₖ · sin(2π·k·f₀·t + φₖ) · e^(−dₖ·t)y(t) = Σₖ Aₖ · sin(2π · k · f₀ · t + φₖ) · exp(−dₖ · t) Sawtooth: Aₖ = 1/k, all k Square: Aₖ = 1/k, odd k only Piano: Aₖ ≈ 1/k · exp(−0.3·k), fast attack, slow decay
Jean-Claude Risset pioneered spectral music in the 1960s using computer-generated additive synthesis. He showed that the characteristic "inharmonicity" of a piano string — where higher partials are slightly sharp of perfect harmonics due to stiffness — is what gives the piano its distinctive timbre. This simulator uses ideal harmonics, but you can hear how dramatic amplitude differences between partials change tone colour entirely.
This simulator builds musical tones the way additive synthesis does: it sums up to 12 sine-wave partials, each at an integer multiple k of a fundamental frequency f₀ (55–880 Hz), each with its own amplitude and exponential decay rate. The Web Audio API generates every partial with an OscillatorNode and GainNode pair, while an AnalyserNode runs a real-time FFT to feed the waterfall spectrogram beneath the oscilloscope.
An oscilloscope traces the combined waveform y(t) = ΣAₖ·sin(2π·k·f₀·t+φₖ)·e^(−dₖ·t) in real time, whilst a waterfall spectrogram below it plots frequency against time, with brightness marking amplitude — revealing exactly which harmonics survive as decay takes hold.
Drag the f₀ slider (55–880 Hz) to shift pitch, set Master Volume (0–100%) and Oscilloscope zoom (0.5×–4×), then tune each of the 12 harmonic rows with its own Amp (0–1) and Decay (0–8) slider, toggle partials on or off, or jump straight to a Sine, Sawtooth, Square, Piano, Clarinet or Bell preset.
Composer Jean-Claude Risset used additive synthesis in the 1960s to show that a real piano's overtones are slightly sharp of perfect integer multiples — that "inharmonicity" is part of what makes a piano sound like a piano rather than an idealised harmonic tone.
It is a method of building a complex sound by adding together simple sine waves (partials) of different frequencies, amplitudes and decay rates, rather than filtering or sampling a pre-recorded tone.
Amp sets that partial's starting amplitude, Aₖ, from 0 to 1. Decay sets dₖ in the exponential envelope e^(−dₖ·t): higher values make that partial's gain fade faster after the note starts, whilst zero keeps it sustained.
Every partial's frequency is defined as k·f₀, so scaling the fundamental scales all 12 partials by the same factor. Their frequency ratios — and therefore the timbre — stay fixed, but the whole tone shifts up or down in pitch.
Sawtooth sets every harmonic's amplitude to 1/k. Square does the same but keeps only the odd-numbered harmonics (k = 1, 3, 5…) and mutes the even ones. Both are classic textbook cases of additive synthesis producing a specific waveform shape.
It reads byte-frequency data from the Web Audio AnalyserNode, which runs a Fast Fourier Transform on the live audio output roughly every 50 milliseconds, turning the time-domain signal into a scrolling frequency-versus-time display.