audio

@audio/filter-resonator1.3.0

Constant-peak-gain resonator

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

Status
calibrated
Updated
Family
filter, 16 packages under it
Plugin
resonator, effect, streaming, 2 parameters
Category
effects
Licence
MIT
Dependencies
none
Downloads
2,340 last month
Tests
at least 129 in audiojs/filter's CI, passed at 878f618,

Listen

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
audio('/samples/music/modern/local-forecast.mp3').resonator()

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html

Parameters

  • effect
  • streaming
  • tail
fc
440 Hz
20 to 20000 Hz
bw
50 Hz
1 to 2000 Hz
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.

The /audio processor holds fc at 0.49 of the sample rate: past Nyquist the resonance would sound at its alias, and every /audio processor of @audio/filter and @audio/eq keeps this one rule. fc is smoothed (20 ms): a host ramps it in calls of 32 frames at most, the section designed again at each call's value.

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