Skip to content

EZ Web Audio / createDistortion

Function: createDistortion()

Call Signature

createDistortion(options?): DistortionEffect

Defined in: packages/core/src/effects/distortion-effect.ts:398

Factory function to create a DistortionEffect.

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

Parameters

options?

DistortionOptions

Optional distortion parameters

Returns

DistortionEffect

A new DistortionEffect instance

Example

typescript
// Zero-config (good defaults)
const dist = createDistortion()

// With options
const dist2 = createDistortion({ type: 'overdrive', amount: 60, tone: 0.7, mix: 0.8 })

// Custom curve
const dist3 = createDistortion({ type: 'custom', curve: myFloat32Array })

// With explicit AudioContext
const dist4 = createDistortion(audioContext, { amount: 50 })

Call Signature

createDistortion(audioContext, options?): DistortionEffect

Defined in: packages/core/src/effects/distortion-effect.ts:399

Factory function to create a DistortionEffect.

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

Parameters

audioContext

BaseAudioContext

options?

DistortionOptions

Optional distortion parameters

Returns

DistortionEffect

A new DistortionEffect instance

Example

typescript
// Zero-config (good defaults)
const dist = createDistortion()

// With options
const dist2 = createDistortion({ type: 'overdrive', amount: 60, tone: 0.7, mix: 0.8 })

// Custom curve
const dist3 = createDistortion({ type: 'custom', curve: myFloat32Array })

// With explicit AudioContext
const dist4 = createDistortion(audioContext, { amount: 50 })