Skip to content

EZ Web Audio / wrapEffect

Function: wrapEffect()

Call Signature

wrapEffect(externalEffect): EffectWrapper

Defined in: effects/effect-wrapper.ts:174

Factory function to wrap an external effect with the Effect interface.

Use this for effects from libraries like Tuna.js, or custom AudioNodes like WaveShaperNode that only have a connect() method.

AudioContext is optional. If omitted, uses the shared library AudioContext.

Parameters

externalEffect

ExternalEffect

The external effect to wrap (or AudioContext as first arg for backwards compatibility)

Returns

EffectWrapper

A new EffectWrapper instance implementing the Effect interface

Example

typescript
// Without AudioContext (recommended)
const wrapped = wrapEffect(distortion)

// With explicit AudioContext (backwards compatible)
const wrapped = wrapEffect(audioContext, distortion)

Call Signature

wrapEffect(audioContext, externalEffect): EffectWrapper

Defined in: effects/effect-wrapper.ts:175

Factory function to wrap an external effect with the Effect interface.

Use this for effects from libraries like Tuna.js, or custom AudioNodes like WaveShaperNode that only have a connect() method.

AudioContext is optional. If omitted, uses the shared library AudioContext.

Parameters

audioContext

AudioContext

externalEffect

ExternalEffect

The external effect to wrap (or AudioContext as first arg for backwards compatibility)

Returns

EffectWrapper

A new EffectWrapper instance implementing the Effect interface

Example

typescript
// Without AudioContext (recommended)
const wrapped = wrapEffect(distortion)

// With explicit AudioContext (backwards compatible)
const wrapped = wrapEffect(audioContext, distortion)