FM Synthesizer — 2-Operator Frequency Modulator
Two-operator FM synthesis with a sine modulator driving the carrier's frequency. Adjust carrier frequency, the modulator/carrier ratio, and the modulation index to shape spectra ranging from pure tone through harmonic to inharmonic and metallic. Live combined waveform plot plus a log-frequency spectrum with markers for the carrier, modulator, and Carson-rule bandwidth edges. 10 preset patches cover the classic FM timbres — bell, electric piano, bass, metallic, wood drum, and more.
Carrier
Modulator
modGain.gain.value is set to internally.Master
Presets
Live readouts
FM Synthesis — Concepts and Patches
Frequency modulation synthesis — FM for short — is the technique John Chowning patented in 1973 and Yamaha turned into the DX7 a decade later. It's a remarkably compact way to generate musically-rich timbres from very few oscillators: a single sine carrier whose frequency is modulated by a single sine modulator can produce thousands of distinct spectra ranging from pure tone to clanging metal, just by varying three numbers. This browser-based FM synthesizer implements that same two-operator architecture entirely through the Web Audio API, so you can explore the mathematics without installing any software.
The FM equation
For a sine carrier modulated by a sine modulator, the output is:
y(t) = sin(2πfct + I · sin(2πfmt))
Three parameters control everything:
- fc — carrier frequency. Determines the perceived pitch when the modulation index is small.
- fm — modulator frequency. Together with fc determines the spectrum shape. We expose this as a ratio (fm / fc) because that's the parameter that stays invariant under transposition.
- I — modulation index. Determines the spectral width — how many sidebands have significant amplitude.
Why sidebands appear at fc ± n·fm
FM is equivalent to additive synthesis of an infinite series of sinusoids. The closed-form identity gives the sideband amplitudes as Bessel functions of the first kind:
y(t) = Σn=−∞+∞ Jn(I) · sin(2π(fc + n·fm)·t)
So each sideband at fc ± n·fm has amplitude Jn(I). For small I most energy stays in the central peak (J0 dominates); as I grows the energy spreads out into higher-order sidebands. At I ≈ 2.40 (the first zero of J0) the carrier amplitude becomes zero — all energy lives in the sidebands. The "Square-like" preset is parked there for exactly this reason.
Integer vs non-integer ratios
- Integer ratio (1:1, 2:1, 3:1, etc.) — all sidebands land on harmonic positions of a common fundamental. The result is a harmonic spectrum that the ear hears as a single pitched tone. The "Sawtooth-like", "Square-like", and "Organ-ish" presets are integer-ratio examples. A ratio of 1:1 is particularly powerful for additive-style FM tones; if you want to compare against a straight additive mix, try the multi-frequency mixer to hear both approaches side by side.
- Non-integer ratio (1.4:1, 3.47:1, 7:1, etc.) — sidebands land at frequencies that aren't integer multiples of any common fundamental, producing inharmonic spectra. These sound like bells, metal bars, and idiophone percussion instruments. Bell, Metallic, and Wood drum are the inharmonic presets here. The key insight is that real-world struck objects (metal bars, bells, chimes) actually have inharmonic overtone series — which is why FM synthesis at non-integer ratios is such an accurate physical model.
Carson's rule and bandwidth
The total bandwidth occupied by the FM signal is well approximated by Carson's rule: BW ≈ 2·(Δf + fm) = 2·fm·(I + 1). The gold dashed markers on the spectrum plot show the BW boundaries; bars outside that range should be barely-visible noise. Carson's rule isn't exact — sidebands extend infinitely in theory — but it captures ~98% of the energy and is what radio engineers use to allocate FM transmitter channels.
What is the modulation index formula, and what is the narrowband vs. wideband difference?
The modulation index is defined as β = Δf / fm, where Δf is the peak frequency deviation and fm is the modulating frequency. Because FM produces infinitely many sidebands (spaced fm apart, with amplitudes given by Bessel functions Jn(β)), the Carson's rule bandwidth estimate of BW ≈ 2(Δf + fm) = 2fm(β + 1) is the standard way to measure how much spectrum the signal actually occupies. When β is much less than 1 (narrowband FM), the bandwidth collapses toward just 2fm and only the first pair of sidebands carries meaningful energy. As β grows (wideband FM), the spectrum fans out proportionally — which is exactly the spectral broadening you can observe by dragging the modulation index slider upward on this tool.
A quick worked example: at carrier 220 Hz, ratio 4 (so fm = 880 Hz), and index 1.5, the peak deviation is Δf = 1.5 × 880 = 1320 Hz, giving a Carson BW of 2 × (1320 + 880) = 4400 Hz — the Electric Piano preset. Double the index to 3 and the BW doubles to 8800 Hz; the gold dashed markers in the spectrum plot jump outward immediately. This relationship is why FM synthesis gives you wide, bright spectra from just two oscillators, as you can also observe by comparing the FM output against a single swept tone in the frequency sweep generator or by analyzing the output's sideband structure in the FFT frequency analyzer.
About the "phase control" the category page mentions
Phase between the carrier and modulator does affect the shape of the output waveform but doesn't affect the audible spectrum (the FFT is invariant under sample-time shifts). For static pure-FM patches you can ignore it. For animated patches where the modulator's phase relative to the carrier changes over time, you'd need a more elaborate setup — outside the scope of this 2-operator demonstration.
FM synthesis vs FM radio: two uses of the same math
The term "frequency modulation" is shared between audio synthesis and radio transmission, but the applications differ significantly. In FM radio broadcasting, a high-frequency carrier (88–108 MHz) is modulated by a low-frequency audio signal; the goal is to encode information faithfully, and the modulation index is kept small (typically below 5) to limit the transmission bandwidth. In FM audio synthesis (Chowning's method), both carrier and modulator are in the audible range, and high modulation indices are desirable because they generate the rich sideband spectra that create musical timbres. The Bessel mathematics is identical; the intent is entirely different.
Relating presets to classic DX7 algorithms
The Yamaha DX7 used 6 operators and 32 fixed "algorithms" (routing diagrams). This tool models just one algorithm: a single modulator feeding a single carrier (algorithm 32 in DX7 terms). The Electric Piano patch (ratio 4, I = 1.5) approximates the DX7's most famous patch — specifically the "EPIANO 1" that appears on countless recordings from the 1980s. The Bell patch (ratio 1.4, I = 4) approximates DX7 algorithm 5 with non-integer ratios giving the slowly-decaying inharmonic spectral structure of a real bell. To hear the full spectrum in detail while adjusting parameters, you can also run the output through the FFT frequency analyzer via your system's loopback audio.