API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classDistortionEffect

@codexo/exojs-audio-fx / audio / stable

Distortion effect built from native Web Audio nodes - no worklet required. The input signal is split into a dry path and a wet path. The wet path runs through a `WaveShaperNode` loaded with a tanh-based soft-clip curve, then through a `BiquadFilterNode` (lowpass) acting as a tone control, before being mixed back with the dry signal. The wave-shaper curve is rebuilt any time `drive` changes. Oversampling is delegated directly to `WaveShaperNode.oversample`. Node graph: ``` input(GainNode) ──── dryGain ─────────────────────────── output(GainNode) input ──── waveShaper ── toneFilter ── wetGain ── output ``` Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.

7
props
1
methods
0
events
Import
import { DistortionEffect } from '@codexo/exojs-audio-fx'

Distortion effect built from native Web Audio nodes - no worklet required.

The input signal is split into a dry path and a wet path. The wet path runs through a `WaveShaperNode` loaded with a tanh-based soft-clip curve, then through a `BiquadFilterNode` (lowpass) acting as a tone control, before being mixed back with the dry signal. The wave-shaper curve is rebuilt any time `drive` changes. Oversampling is delegated directly to `WaveShaperNode.oversample`.

Node graph: ``` input(GainNode) ──── dryGain ─────────────────────────── output(GainNode) input ──── waveShaper ── toneFilter ── wetGain ── output ``` Gains: `dryGain.gain = 1 - wet`; `wetGain.gain = wet`.

Constructors1
Methods1
destroy(): void
Disconnects all audio nodes and releases resources. Must be called when the effect is no longer needed.
Properties7
drive: number
Drive amount controlling the soft-clip intensity. Range 0..1, default 0.4. Changing this rebuilds the wave-shaper curve immediately (sample-accurate on the next render quantum).
inputNode: AudioNode
The node where audio enters this effect. Throws if the audio context is not yet initialized.
outputNode: AudioNode
The node where audio exits this effect. Throws if the audio context is not yet initialized.
oversample: OverSampleType
Oversampling mode for the WaveShaperNode. One of 'none', '2x', or '4x'. Higher values reduce aliasing but increase CPU usage. Default '2x'.
ready: Promise<void>
Resolves when the effect is fully initialized. Defaults to immediately-resolved for sync effects.
tone: number
Tone control: low-pass cutoff on the wet path. 0 = fully dark (~100 Hz), 1 = fully open (~20 kHz). Mapped logarithmically. Default 1. Changes are ramped smoothly via setTargetAtTime.
wet: number
Wet (distorted) mix level, 0..1. The dry level is automatically 1 - wet. Changes are ramped smoothly via setTargetAtTime. Default 1.0.
Source