freqr
v1.0.0
Published
Compute the frequency response of a digital filter
Downloads
3
Readme
freqr
Compute the frequency response of a digital filter.
Installation
npm install freqr
Quick Example
const freqr = require("freqr");
// type: "lowpass", freq: 2400hz, Q: 8
const b = [ 0.027136, 0.054272, 0.027136 ];
const a = [ 1.000000, -1.766316, 0.874860 ];
for (let f = 0; f < 0.2; f += 0.0025) {
const res = freqr(b, a, f);
console.log(res);
}
API
freqr(b, a, f)
b: number[]
- coefficients of feedforwarda: number[]
- coefficients of feedbackf: number
- normalized frequency [0..1]f = frequency / sampleRate
- returns
mag: number
phase: number
db: number
db = 20 * Math.log(mag) / Math.LN10
License
MIT