Class StereoDelay

A stereo delay: the left and right channel are delayed independently, each with its own delay time. Different times (for example 300 and 450 ms) make the sound wider.

Extends Effector (through the internal DelayEngine base class).

All four delays (MonoDelay, StereoDelay, PingPongDelay and AdvancedDelay) run the same WebAssembly delay engine in a different mode. Delay time changes glide smoothly over about 50 ms, so changing the time while audio plays gives a short pitch bend instead of a click. The delay keeps processing when its input goes silent, so echoes ring out naturally.

Example

import { StereoDelay } from "@fluex/fluexgl-dsp";

const delay = new StereoDelay({ delayLeftMs: 300, delayRightMs: 450, feedback: 0.35, mix: 0.3 });

channel.addEffect(delay);

Constructor

new StereoDelay(options?: Partial<StereoDelayOptions>): StereoDelay;

Arguments


Properties

label: string | null

Defaults to "StereoDelay".

name: string

Defaults to "StereoDelay".

delayLeftMs: number

Delay time of the left channel (ms), between 1 and 4000. Defaults to 300.

delayRightMs: number

Delay time of the right channel (ms), between 1 and 4000. Defaults to 450.

feedback: number

Between 0 and 0.98. Defaults to 0.35.

mix: number

Dry/wet mix, between 0 and 1. Defaults to 0.35.

strictMode: StrictMode

Defaults to StrictMode.Disabled.


Methods

initializeOnAttachment(context: AudioContext): Promise<void>

Creates the StereoDelayProcessor AudioWorklet node with the current values.

returnOptionsAsObject(): StereoDelayOptions

Returns a snapshot of the current values.

setDelayLeftMs(delayMs: number): boolean

Sets the delay time of the left channel (ms).

Arguments

  • delayMs: number

Returns

  • boolean - true when the value was sent to the processor (or applied to the audio node), false when the effect is not attached yet. The value is stored either way and used on attachment.

setDelayRightMs(delayMs: number): boolean

Sets the delay time of the right channel (ms).

Arguments

  • delayMs: number

Returns

  • boolean - true when the value was sent to the processor (or applied to the audio node), false when the effect is not attached yet. The value is stored either way and used on attachment.

setFeedback(feedback: number): boolean

Sets the feedback, clamped between 0 and 0.98.

Arguments

  • feedback: number

Returns

  • boolean - true when the value was sent to the processor (or applied to the audio node), false when the effect is not attached yet. The value is stored either way and used on attachment.

setMix(mix: number): boolean

Sets the dry/wet mix, clamped between 0 and 1.

Arguments

  • mix: number

Returns

  • boolean - true when the value was sent to the processor (or applied to the audio node), false when the effect is not attached yet. The value is stored either way and used on attachment.

Notes

A mono input is treated as the same signal on both sides. With equal times, StereoDelay then sounds like MonoDelay.


Events

Inherited from Effector. The StereoDelayProcessor processor sends processor-wasm-instantiated when its WebAssembly module is ready, and an incoming-processor-message for every parameter change.

Requirements

Runs on an AudioWorklet backed by WebAssembly. Attach it only after await pipeline.initializeDpsPipeline(), on the AudioDevice returned by resolveDefaultAudioOutputDevice(). Requires a worklet and WASM build from FluexGL-DSP-WebAssembly 0.4.9 or newer, which registers StereoDelayProcessor.