Echo
Adds a delayed, fading repeat of the signal: a feedback echo (simple delay line). Each repeat is quieter than the previous by the feedback factor, producing a natural decay tail. The mix prop controls the wet/dry blend.
Usage
import { Sound, AudioFilters } from '@motion-script/core';
// Via AudioFilters builder — 300 ms delay, 40% feedback, default 50% wet mix
const clip = new Sound({ src: './voice.mp3', filters: AudioFilters.echo({ delay: 0.3, feedback: 0.4 }) });
// With explicit mix — mostly dry, subtle echo
const clip = new Sound({ src: './voice.mp3', filters: AudioFilters.echo({ delay: 0.5, feedback: 0.6, mix: 0.25 }) });
// Via raw object
const clip = new Sound({
src: './voice.mp3',
filters: [{ type: 'echo', delay: 0.3, feedback: 0.4, mix: 0.5 }],
});
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'echo' | – | Filter identifier |
delay | number | – | Time before the first repeat, in seconds |
feedback | number | – | Repeat decay factor, 0–<1. Each echo is this fraction of the previous |
mix | number | 0.5 | Wet/dry blend. 0 = dry signal only, 1 = fully wet (no original) |
Animating
Fade the echo in to add spaciousness over time:
import { Sound, AudioFilters, tween, lerpNumber, easeOut } from '@motion-script/core';
const clip = new Sound({ src: './narration.mp3', filters: AudioFilters.echo({ delay: 0.4, feedback: 0.5, mix: 0 }) });
clip.start();
// Crossfade to a wet echo over 3 seconds
yield* tween(3, (t) => {
clip.set({ filters: AudioFilters.echo({ delay: 0.4, feedback: 0.5, mix: lerpNumber(0, 0.6, easeOut(t)) }) });
});
Stacking with other filters
// Muffle the echo tails with a low-pass
AudioFilters.echo({ delay: 0.3, feedback: 0.5 }).lowpass(3000)
// Quieter source into a long, washy reverb-like echo
AudioFilters.gain(0.7).echo({ delay: 0.6, feedback: 0.75, mix: 0.4 })
Notes
feedbackmust be strictly less than1. A value of1or above creates an infinite loop that never decays.- Long
delayvalues (> 1s) with highfeedback(> 0.7) can cause the tail to accumulate loudly. Preview with lowmixfirst. - All three props (
delay,feedback,mix) are fully animatable.