fmsynth
Fmsynth — 4-operator FM synth. algorithm 0–7 / op1–op4: { ratio, index, decay } / gain.
Quick Start
fmsynth({ algorithm: 0, gain: 0.5 })Parameters
| Name | Type | Default | Range/Options | Description |
|---|---|---|---|---|
algorithm | enum | 0 | 0 1 2 3 4 5 6 7 | FM algorithm (0 = serial chain / bell, 7 = additive) |
wave | enum | sine | sine square sawtooth triangle | Carrier waveform |
baseFreq | number | — | 1–20000 Hz | Carrier base frequency. When set, overrides the per-note pitch from play() |
op1 | string | — | — | Operator 1 (primary carrier): { ratio, index, decay } — index supports LfoSpec |
op2 | string | — | — | Operator 2: { ratio, index, decay } — index supports LfoSpec |
op3 | string | — | — | Operator 3: { ratio, index, decay } — index supports LfoSpec |
op4 | string | — | — | Operator 4: { ratio, index, decay } — index supports LfoSpec |
attack | number | 0.005 | 0–10 s | Attack time |
decay | number | 0.3 | 0–10 s | Decay time |
sustain | number | 0.5 | 0–1 0–1 | Sustain level (0 = percussive mode) |
release | number | 0.2 | 0–10 s | Release time |
pitchMult | number | 1 | 1–10 | Pitch sweep start multiplier (1.0 = no sweep) |
pitchDecay | number | 0.05 | 0–1 s | Pitch sweep time |
gain | number | 0.5 | 0–1 0–1 | Output gain |