Skip to content

Effects Chain ​

Press Play to hear a four-note plucked pattern. Bypass the delay to hear which notes are echoes, then try the sustained oscillator or looping audio file through the same chain.

Build, reorder, and hear an effects chain.

Source:
Plucked synth arpeggio at 120 BPM through the effect chain below
EQ
0.0dB
0.0dB
0.0dB
Compressor
-24dB
4.0:1
30dB
3ms
250ms
Delay
0.20s
25%
30%
Reverb
1.5s
30%
35%
Click Play to start

How It Works ​

The pattern uses a gain node to open and close each pluck before it reaches the first effect. The delay can repeat a note after the pluck ends, and the reverb can ring into the next step.

Source → Effect 1 → Effect 2 → Effect 3 → Effect 4 → Output

The library connects effects in the order you add them. Put the compressor before the reverb to compress the incoming notes, or after it to compress the notes and their reflections together.

Building a Chain ​

Call startChain() from a Play button’s click handler. Keep the returned source and effects for the bypass, reorder and cleanup operations below.

typescript
import {
  createCompressor,
  createDelay,
  createEQ,
  createOscillator,
  createReverb,
} from 'ez-web-audio'

export async function startChain() {
  const source = await createOscillator({ frequency: 440, type: 'sawtooth', gain: 0.12 })

  const delay = createDelay({ time: 0.3, feedback: 0.4, mix: 0.3 })
  const reverb = createReverb({ decay: 2.5, mix: 0.35 })
  const compressor = createCompressor({ threshold: -24, ratio: 4 })
  const eq = createEQ({ low: 0, mid: 0, high: 2 })

  // Effects are connected in array order
  source.addEffects([delay, reverb, compressor, eq])
  await source.play()
  return { source, delay, reverb, compressor, eq }
}

Bypassing an Effect ​

typescript
delay.bypass = true // Dry signal passes through unaffected
delay.bypass = false // Effect re-enters the signal chain

Reordering Effects ​

To move one effect, remove it and insert it at its new index.

typescript
// The delay stays first, followed by compressor, reverb and EQ.
source.removeEffect(compressor)
source.addEffect(compressor, 1)

Cleanup ​

typescript
source.dispose() // Stops playback and disposes the effects attached to the source

Effect Parameters ​

EffectKey ParametersNotes
Delaytime (0.05–1s), feedback (0–0.9), mix (0-1)Higher feedback = longer echo tail
Reverbdecay (seconds), damping (0–1), mix (0–1)Simulates room reflections
Compressorthreshold (dBFS), ratio (N:1)Reduces dynamic range
EQlow, mid, high (dB gain)Three-band shelving/peak EQ

Further Reading ​