@audio/biquad (英语)
音频-侧面双曲-RBJ Cookbook系数+状态SOS内核.
一个系数/内核源 @audio 生态系统。 协同效应遵循网络音频惯例(bandpass = 常数 0 dB 峰值增益;差异测试比对 数字过滤器 (通用设计参考文献-butworth, linkwitz-riley, match-z stay there)到1e-9. 零从属.
import { lowpass, peaking, filter, process, step, state, cascade, magnitude } from '@audio/biquad'
// coefficients — (fc, Q, fs[, dB]), normalized a0 = 1
let c = lowpass(1000, 0.707, 44100) // also: highpass, bandpass, notch, allpass,
let pk = peaking(2000, 1, 44100, 6) // peaking, lowshelf, highshelf
// params-convention kernel — coefs + state ride the params object (streaming: state persists across calls)
let params = { coefs: [c, pk] }
filter(chunk, params)
// section-level kernel
let s = state()
process(chunk, c, s) // buffer through one section, in place
let y = step(c, s, x) // one sample (sidechain/per-sample use)
cascade(chunk, [c, pk]) // buffer through SOS chain
magnitude(c, 440, 44100) // |H(f)| — analysis/plotting
转换为直式-II; Float64Array(2) 状态; 所有处理都到位.
另见
@audio/filter-biquad——在这个内核上建起的音频化滤波原子digital-filter——通用滤波器设计(scijs分层)
许可证
麻省理工学院