Constant-peak-gain resonator (JOS two-zero form)
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
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.
Pole radius: — controls bandwidth; gives infinite Q
Peak gain: always 0 dB by construction — the two zeros at shape the numerator so 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