audioJS

@audio/filter-comb

Status calibrated

npm1.1.3licenseMIT

Comb filter — feedforward (FIR) and feedback (IIR)

Overview

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

Adds a delayed copy of the signal to itself — notches and peaks at harmonics of fs/Df_s / D.

Feedforward: H(z)=1+g⋅z−DH(z) = 1 + g \cdot z^{-D} — dips at f=(2k+1)fs2Df = \frac{(2k+1) f_s}{2D}, depth depends on gg: a true null only at ∣g∣=1|g|=1; the default g=0.5g=0.5 gives a −6 dB-6\,\text{dB} dip, not a notch
Feedback: H(z)=11−g⋅z−DH(z) = \dfrac{1}{1 - g \cdot z^{-D}} — peaks at f=k⋅fsDf = \frac{k \cdot f_s}{D}

comb(buffer, { delay: 100, gain: 0.6, type: 'feedback' })
Param Default
delay — required, delay length in samples (D)
gain 0.5 feedforward/feedback coefficient g
type 'feedforward' 'feedforward' (FIR, dips) or 'feedback' (IIR, peaks)

Pass the same params object on every call — the ring buffer and write pointer persist across blocks:

let params = { delay: 100, gain: 0.6, type: 'feedback' }
for (let buf of stream) comb(buf, params)

Use when: flanging, chorus (with modulated delay), Karplus-Strong string synthesis, room mode modeling.


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

MIT © audiojs