LFO — One Knob, Three Effects
Explore Low Frequency Oscillator (LFO) modulation effects. An LFO generates a slow waveform that modulates an audio parameter -- creating effects like tremolo (volume wobble), vibrato (pitch wobble), and filter sweeps (tone color changes).
Try the presets to hear each effect, then adjust the rate, depth, and waveform shape to explore how LFO parameters affect the sound.
One LFO, three musical effects, seen and heard at once.
Tremolo · amplitude
Presets:
How It Works
- Tremolo modulates the oscillator's gain (volume), creating a pulsing effect
- Vibrato modulates the oscillator's frequency (pitch), creating a wobbling effect
- Filter Sweep modulates a lowpass filter's cutoff frequency, creating a wah-like tone sweep
Code Example
typescript
import { createLFO, createOscillator } from 'ez-web-audio'
const oscillator = await createOscillator({ frequency: 440, type: 'sawtooth' })
// Create an LFO at 5 Hz with sine wave
const lfo = createLFO({ frequency: 5, depth: 0.3, type: 'sine' })
// Connect to gain for tremolo effect
lfo.connect(oscillator, 'gain')
lfo.start()
oscillator.play()
// When done, stop in reverse order — LFO first, then source
lfo.stop()
lfo.disconnect()
oscillator.stop()Cleanup
Always stop the LFO before stopping the audio source to avoid a brief gain pop:
typescript
lfo.stop()
lfo.disconnect() // Remove from all modulation targets
oscillator.stop()For automatic cleanup tied to the sound's lifecycle, use syncLifecycle:
typescript
lfo.connect(oscillator, 'gain', { syncLifecycle: true })
// LFO stops and disconnects automatically when oscillator.stop() is called
oscillator.stop()Further Reading
- LFO Guide -- full API reference, waveform types, depth units, and lifecycle options
- Effects Chain -- combine LFO modulation with delay, reverb, and EQ
- PolySynth -- apply tremolo or vibrato to polyphonic voices