audioJS

@audio/filter-resonator

Status calibrated

npm1.2.1licenseMIT

Constant-peak-gain resonator (JOS two-zero form)

Overview

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

Constant peak-gain bandpass — peak amplitude stays fixed regardless of bandwidth.

H(z)=1−R22(1−z−2)1−2Rcos⁡(ω0)z−1+R2z−2H(z) = \dfrac{\frac{1-R^2}{2}(1 - z^{-2})}{1 - 2R\cos(\omega_0)z^{-1} + R^2 z^{-2}}

Pole radius: R=e−π⋅bw/fsR = e^{-\pi \cdot bw / f_s} — controls bandwidth; bw→0bw \to 0 gives infinite Q
Peak gain: always 0 dB by construction — the two zeros at z=±1z = \pm 1 shape the numerator so (1−R2)/2(1-R^2)/2 normalizes the pole peak regardless of fc/bw (verified ±0.01 dB across fc ∈ {50, 440, 5000, 15000} Hz, bw ∈ {5, 20, 200} Hz)
Origin: Julius O. Smith III, Introduction to Digital Filters with Audio Applications — Two-Pole, "Constant Peak-Gain Resonator"

resonator(buffer, { fc: 440, bw: 20, fs: 44100 })
Param Default
fc — required, center frequency Hz
fs 44100 sample rate, Hz
bw 50 bandwidth, Hz — smaller = higher Q

Pass the same params object on every call to persist the two-pole state across blocks. Internal cache fields are prefixed _r* (_rFc, _rA1, …) so params can double as a caller-owned object — e.g. @audio/speech-formant shares one params object per formant band.

Use when: additive synthesis (bells, gongs), modal synthesis, formant bank building.

vs Peaking EQ: resonator has fixed 0 dB peak; peaking EQ has variable gain — use resonator for synthesis, EQ for mixing.


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

MIT © audiojs