biquad-coeffs-maxmsp
Max/MSP formulae for audio EQ biquad filter coefficients
Installation
$ npm install --save biquad-coeffs-maxmsp
API
[filterType](freq, q, gain): number[]
filterType: string
- "lowpass"
- "highpass"
- "bandpass"
- "notch"
- "allpass"
- "peaking"
- "lowshelf"
- "highshelf"
- "resonant"
freq: number
filter cutoff or center frequency- This parameter should be normalized (0..1).
normalizedFrequency = frequency / sampleRate
q: number
filter Q (resonance) or slopegain: number
filter gain- returns coeffs
[ b0, b1, b2, a1, a2 ]
(a0 = 1)
Usage
DSP
const coeffs = ; const b0 b1 b2 a1 a2 = coeffs;const signal = 2048; let x0 x1 = 0 x2 = 0;let y0 y1 = 0 y2 = 0; for let i = 0; i < signallength; i++ x0 = signali; y0 = b0 * x0 + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2; signali = y0; x2 = x1; x1 = x0; y2 = y1; y1 = y0;
Web Audio API
const coeffs = ; const b0 b1 b2 a1 a2 = coeffs;const audioContext = ;const oscillator = audioContext;const filter = audioContext; oscillatortype = "sawtooth";oscillatorfrequencyvalue = 880;oscillatorstartaudioContextcurrentTime;oscillator;oscillator; filter;
License
MIT