EZ Web Audio / EffectWrapper
Class: EffectWrapper
Defined in: effects/effect-wrapper.ts:50
EffectWrapper - Wraps external effects (like Tuna.js, custom WaveShaperNode, etc.) to provide a standard Effect interface with bypass and wet/dry mix controls.
External effects only need a connect() method to be wrapped. The wrapper creates the necessary infrastructure for wet/dry mixing and bypass functionality.
Supported Effect Types
Supports three types of external effects:
- Tuna.js effects — Have an
inputAudioNode property - Native AudioNodes — WaveShaperNode, ConvolverNode, etc.
- Any object with connect() — Minimum interface requirement
Routing:
- Dry path: input -> dryGain -> output
- Wet path: input -> externalEffect -> wetGain -> output
Example
// Wrap a Tuna.js effect
const tuna = new Tuna(audioContext)
const chorus = tuna.Chorus({ rate: 1.5 })
const wrapped = wrapEffect(audioContext, chorus)
// Now use standard Effect interface
wrapped.bypass = true // Bypass the effect
wrapped.mix = 0.5 // 50% wet/dry blend
// Access original effect
wrapped.effect.rate = 2.0Implements
Constructors
Constructor
new EffectWrapper(
audioContext,externalEffect):EffectWrapper
Defined in: effects/effect-wrapper.ts:60
Parameters
audioContext
AudioContext
externalEffect
Returns
EffectWrapper
Accessors
bypass
Get Signature
get bypass():
boolean
Defined in: effects/effect-wrapper.ts:115
When true, signal bypasses the effect entirely (100% dry).
Returns
boolean
Set Signature
set bypass(
v):void
Defined in: effects/effect-wrapper.ts:119
When true, effect is bypassed (passthrough)
Parameters
v
boolean
Returns
void
When true, effect is bypassed (passthrough)
Implementation of
effect
Get Signature
get effect():
ExternalEffect
Defined in: effects/effect-wrapper.ts:141
Access the wrapped external effect for configuration. This allows direct manipulation of the effect's native properties.
Returns
input
Get Signature
get input():
AudioNode
Defined in: effects/effect-wrapper.ts:103
The input AudioNode (receives signal from chain)
Returns
AudioNode
The input AudioNode that receives signal from the chain
Implementation of
mix
Get Signature
get mix():
number
Defined in: effects/effect-wrapper.ts:128
Wet/dry mix: 0 = fully dry (no effect), 1 = fully wet (all through effect). Uses equal-power crossfade for natural mixing.
Returns
number
Set Signature
set mix(
v):void
Defined in: effects/effect-wrapper.ts:132
Wet/dry mix: 0 = fully dry (no effect), 1 = fully wet (full effect)
Parameters
v
number
Returns
void
Wet/dry mix: 0 = fully dry (no effect), 1 = fully wet (full effect)
Implementation of
output
Get Signature
get output():
AudioNode
Defined in: effects/effect-wrapper.ts:108
The output AudioNode (sends signal to next in chain)
Returns
AudioNode
The output AudioNode that sends signal to the next in chain