High-Pass
Attenuates frequencies below the cutoff, letting the highs through. Useful for removing low-frequency rumble, thinning out a mix, or isolating vocals and high-pitched elements.
Usage
import { Sound, AudioFilters } from '@motion-script/core';
// Via AudioFilters builder — remove everything below 200 Hz
const clip = new Sound({ src: './voice.mp3', filters: AudioFilters.highpass(200) });
// With resonance boost at the cutoff
const clip = new Sound({ src: './voice.mp3', filters: AudioFilters.highpass({ frequency: 300, q: 2 }) });
// Via raw object
const clip = new Sound({ src: './voice.mp3', filters: [{ type: 'highpass', frequency: 200 }] });
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'highpass' | – | Filter identifier |
frequency | number | – | Cutoff frequency in Hz. Content below this is rolled off |
q | number | 1 | Resonance (Q factor) at the cutoff. Higher values add a peak just before the roll-off |
Animating
Sweep the cutoff frequency to create a filter-open effect:
import { Sound, AudioFilters, tween, lerpNumber } from '@motion-script/core';
const clip = new Sound({ src: './music.mp3', filters: AudioFilters.highpass(2000) });
clip.start();
// Sweep cutoff from 2000 Hz down to 80 Hz over 3 seconds
yield* tween(3, (t) => {
clip.set({ filters: AudioFilters.highpass(lerpNumber(2000, 80, t)) });
});
Notes
- A Q of
1gives a gentle Butterworth-style roll-off. Values above5create a noticeable resonant peak that can be used as a creative effect. - High-pass and low-pass filters can be chained to form a band-pass:
AudioFilters.highpass(200).lowpass(3000). - Both
frequencyandqare fully animatable.