audioJS

@audio/filter-variable

Status calibrated

npm1.2.3licenseMIT

Variable-bandwidth filter with per-sample smoothed coefficient trajectory

Overview

Install
Updated
Family
filter, 16 packages under it
Tags
shape
import variableBandwidth from '@audio/filter-variable'

Lowpass with continuously variable bandwidth — smooth parameter automation without discontinuities.

Implementation: fc/Q are exponentially smoothed toward their target values with a 5 ms time constant, and biquad coefficients are recomputed from the smoothed values every sample (not once per buffer)
Property: no discontinuity when fcf_c or QQ change — a mid-buffer step change lands ~9x closer to the plain-lowpass baseline than an abrupt coefficient jump; once converged, steady-state output equals plain lowpass/highpass/bandpass

variableBandwidth(buffer, { fc: 2000, Q: 1.0, fs: 44100 })
Param Default
fc 1000 target cutoff/center frequency, Hz
Q 0.707 target quality factor
fs 44100 sample rate, Hz
type 'lowpass' 'lowpass', 'highpass', or 'bandpass'

Pass the same params object on every call — mutate params.fc/params.Q in place between calls; the smoothing state and biquad state both persist on the object.

let p = { fc: 200, Q: 1.0, fs: 44100 }
for (let buf of stream) {
  p.fc = 200 + lfo() * 1800   // mutate in-place — state preserved
  variableBandwidth(buf, p)
}

Use when: LFO-modulated filter cutoff, automated EQ sweeps, smooth filter animation.

vs Direct biquad: recalculating biquad coefficients per sample causes zipper noise; variable bandwidth avoids this.


Part of @audio/filter — the filter family umbrella. This README is generated from the umbrella docs.

MIT © audiojs