Low-Pass
Attenuates frequencies above the cutoff, letting the lows through. Use it to muffle audio, simulate sound heard through a wall or underwater, or soften a harsh mix.
Usage
import { Sound, AudioFilters } from '@motion-script/core';
// Via AudioFilters builder — muffle everything above 1000 Hz
const clip = new Sound({ src: './music.mp3', filters: AudioFilters.lowpass(1000) });
// With resonance boost at the cutoff
const clip = new Sound({ src: './music.mp3', filters: AudioFilters.lowpass({ frequency: 800, q: 3 }) });
// Via raw object
const clip = new Sound({ src: './music.mp3', filters: [{ type: 'lowpass', frequency: 1000 }] });
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'lowpass' | – | Filter identifier |
frequency | number | – | Cutoff frequency in Hz. Content above this is rolled off |
q | number | 1 | Resonance (Q factor) at the cutoff. Higher values add a peak just before the roll-off |
Animating
Animate the cutoff to smoothly muffle audio over time. This is a common technique for scene transitions:
import { Sound, AudioFilters, tween, lerpNumber, easeIn } from '@motion-script/core';
const clip = new Sound({ src: './ambient.mp3', filters: AudioFilters.lowpass(20000) });
clip.start();
// Muffle the audio as the scene fades out
yield* tween(2, (t) => {
clip.set({ filters: AudioFilters.lowpass(lerpNumber(20000, 400, easeIn(t))) });
});
Notes
20000Hz is effectively unfiltered for most audio content, so use it as a "pass-through" starting value when animating.- Pair with a high-pass filter to isolate a frequency band:
AudioFilters.highpass(200).lowpass(3000). - Both
frequencyandqare fully animatable.