🎹

Frequency Modulator Tool

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

Log slider from 30 Hz to 2 kHz. The pitch you hear is the carrier (when index is small).
Sine is canonical Chowning FM; other waveforms add the carrier's own harmonics to the FM spectrum.

Modulator

Log slider from 0.1 to 20. Integer ratios → harmonic spectra (musical); non-integer → inharmonic (bell, metallic).
= ratio × carrier. Pink dashed marker on the spectrum.
Linear 0–25. I = 0 → pure carrier. I ≈ 2.40 → carrier vanishes (J0 null). Higher I → wider, brighter spectrum.
Δf = I · modulator frequency. This is what modGain.gain.value is set to internally.

Master

High-index FM can sound piercing. Start moderate.
Idle — press Play.

Presets

Picking a preset overwrites all carrier / ratio / index settings immediately. The dropdown resets after, so you can re-pick the same patch to reset.

Live readouts

Carson bandwidth
2·(Δf + fm)
Sample rate
AudioContext.sampleRate
FM output waveform (analyser live)
FM spectrum — Bessel sidebands · green = carrier · pink dash = modulator · gold dash = Carson BW edges

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.

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.
  • 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 percussion instruments. Bell, Metallic, and Wood drum are the inharmonic presets here.

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.

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.

Frequently Asked Questions

Why does the carrier marker disappear into the noise at index ≈ 2.40?
Because J0(2.4048) is the first zero of the Bessel J0 function — the carrier amplitude is mathematically zero at that index. All the energy moves into the sidebands. This is the most famous "FM identity" and is the reason the Square-like preset lands at exactly I = 2.4048; you can hear the spectrum become symmetric and the carrier note disappear from perceived pitch.
Why does the same ratio sound different at different carrier frequencies?
Because pitch perception is logarithmic but the modulation deviation in Hz is linear. At carrier 110 Hz with ratio 2, modulator is 220 Hz — Δf for I=3 is 660 Hz, which is multiple octaves above the carrier and produces a bright spectrum. At carrier 1000 Hz with the same settings, modulator is 2000 Hz and Δf is 6000 Hz — but those higher frequencies are perceived more compressed by the ear. The ratio is invariant; the timbre will be similar but never identical across octaves.
What does a non-sine modulator do?
A square modulator effectively switches the carrier frequency between two values each cycle (a "gate" effect). A sawtooth modulator produces a ramp through the deviation range. A triangle modulator is similar to sine but with slightly different sideband distribution. All of these are non-canonical FM — the Bessel math no longer applies cleanly — but they produce useful synthesis textures. Try ratio 1 with a square modulator to hear two-tone alternation.
Can I get a percussive attack like a real DX7 patch?
Not in this tool — the modulation index is fixed at whatever the slider says. A real percussive FM patch uses an envelope generator that ramps the modulation index from high to low over a few hundred milliseconds, producing the characteristic FM bell "ping" or wood drum "thump". This tool is for exploring static spectra; pair it with an envelope generator or a real synth to add motion.
Why is the spectrum sometimes asymmetric around the carrier?
The Bessel coefficients Jn(I) are positive for even n and alternate sign for odd n. When two sidebands fall on the same frequency bin (e.g. when fc − n·fm wraps below zero and folds back), they can partially cancel or reinforce. For typical ratios and indices the spectrum looks symmetric around the carrier; pushing index and ratio high enough to wrap negative-frequency sidebands back into the positive range creates the asymmetry you're seeing.
Does the Carson bandwidth marker tell me when I'm aliasing?
It's an approximation, not a guarantee. Carson covers ~98% of the energy — the remaining ~2% extends beyond the markers and can alias if pushed close to Nyquist. The tool's parameter ranges (carrier up to 2 kHz, ratio up to 20, index up to 25) cap the worst-case Carson BW at around 30 kHz on a 48 kHz context, so the upper sidebands are usually safe; extreme settings will alias slightly.
Can I save the output to a file?
Not in this build — the tool focuses on real-time exploration. To capture a sound, use OS-level audio recording (loopback / Stereo Mix on Windows, BlackHole on Mac) while the tool is playing. The patch parameters are deterministic, so noting down the ratio + index + waveform is enough to reproduce a sound exactly later.
How is this different from the Multi-Frequency Mixer?
The mixer adds multiple oscillator outputs together — additive synthesis. This tool modulates one oscillator's frequency with another — that's a fundamentally different operation that produces an infinite series of sidebands from just two sine waves. For the same compute budget FM achieves much richer spectra than additive synthesis, which is why it dominated 80s digital synthesizers.