audioJS

@audio/eq-fir

Status calibrated

npm1.0.2licenseMIT

FIR convolution EQ — linear-phase, arbitrary magnitude response (frequency-sampling design; firequalizer / match-EQ class)

Overview

Install
Updated
Family
eq, 10 packages under it
Tags
shape

Linear-phase FIR EQ from an arbitrary magnitude response — firequalizer / match-EQ class

import firEq, { design } from '@audio/eq-fir'

FFmpeg firequalizer's class of EQ: frequency-sampling design builds an odd-length, type-I symmetric FIR from a target dB curve (a list of {f, gain} points, linearly interpolated, or a frequency => dB function), Hann-windowed against Gibbs ripple. Whole-buffer, time-aligned apply — the group delay of (taps-1)/2 samples is compensated internally, so the filtered output stays time-aligned with the input. This is the substrate for match-EQ tools like Matchering: hand it a captured target spectrum and it approximates that response with a finite, windowed FIR. Resolution and ripple depend on the tap count.

firEq(data, { response: [{ f: 100, gain: -3 }, { f: 1000, gain: 0 }, { f: 8000, gain: 4 }] })

// or design once, reuse across buffers
let coefs = design(f => (f > 5000 ? 6 : 0), { taps: 1023, fs: 48000 })
firEq(bufA, { coefs })
firEq(bufB, { coefs })
Param Default
response — {f, gain}[] dB points (linear interpolation, clamped outside) or f => dB function. Ignored if coefs given
coefs — Precomputed Float64Array from design() — skips the design step
taps 511 FIR length — forced odd (type-I symmetric)
fs 44100 Sample rate, Hz

Unlike the biquad-based atoms in this family, firEq holds no state across calls — taps/response (or coefs) are used fresh every call, convolved directly against data with zero-padded edges. There's no streaming/chunked mode: call it with the whole buffer. Only typed arrays are accepted (Float32Array/Float64Array, via TypedArray#set) — plain number[] is not supported.

Use when: approximating a captured target spectrum with a linear-phase filter, or any EQ curve too irregular for a handful of biquads — where phase linearity matters more than CPU cost.


Part of @audio/eq — the eq family umbrella.

MIT © audiojs