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.
Algorithm
Define a fundamental f₀ and up to 12 harmonic partials at k·f₀ (k = 1…12).
Each partial k has amplitude Aₖ ∈ [0,1] and decay rate dₖ ≥ 0.
Oscilloscope zoom — magnify the waveform vertically.
Did You Know?
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.
Frequently Asked Questions
What is additive synthesis?
Additive synthesis builds complex sounds by summing pure sine waves (partials) at different frequencies and amplitudes. Each partial contributes to the overall timbre, and by controlling their mix you can recreate almost any acoustic instrument or invent entirely new timbres.
What is the harmonic series?
The harmonic series is the set of frequencies that are integer multiples of a fundamental frequency f₀: f₀, 2f₀, 3f₀, 4f₀, … These arise naturally when a string, pipe, or membrane vibrates, and they define the characteristic richness of musical tones.
How does timbre differ from pitch?
Pitch corresponds to the fundamental frequency — how high or low a note sounds. Timbre (tone colour) is determined by the relative amplitudes of the overtones. Two instruments playing the same pitch have different timbres because their partial spectra differ.
What are partials and overtones?
A partial is any sinusoidal component of a complex sound. Overtones are partials above the fundamental. When partials are exact integer multiples (k·f₀) they are called harmonics; non-integer multiples produce inharmonic, bell-like or metallic timbres.
What does the decay parameter control?
Each partial can be given an exponential decay envelope exp(−d·t). A high decay value makes the partial fade rapidly after onset, mimicking plucked or struck instruments. A decay of zero gives a sustained, organ-like tone.
What is a spectrogram?
A spectrogram plots frequency on the vertical axis against time on the horizontal axis, with brightness or colour indicating amplitude. The waterfall spectrogram in this simulation shows how the spectrum evolves as decays take effect, revealing which partials persist.
Why does doubling the fundamental change all the overtones?
Because overtone frequencies are k·f₀, scaling f₀ scales all partials proportionally. The interval relationships between partials remain constant — the timbre is preserved — but the overall pitch rises by one octave.
How does the Web Audio API generate sine waves?
An OscillatorNode set to type 'sine' outputs a pure sinusoid at its frequency. A GainNode downstream scales its amplitude. By connecting many oscillator–gain pairs to a single DestinationNode and summing them, the browser efficiently performs real-time additive synthesis on the GPU audio pipeline.
What is a Fourier transform and why is it used here?
A Fourier transform decomposes any periodic waveform into its sinusoidal components. The Web Audio AnalyserNode applies a real-time FFT (Fast Fourier Transform) to the audio output, turning the time-domain waveform into a frequency spectrum displayed in the spectrogram.
What makes a sawtooth or square wave from harmonics?
A sawtooth wave is formed by adding all harmonics with amplitudes 1/k (Aₖ = 1/k). A square wave uses only odd harmonics (k = 1, 3, 5, …) with amplitudes 1/k. These classic waveforms are special cases of additive synthesis, demonstrating that any periodic signal is a sum of sinusoids.