@hecto/signal
v3.0.0
Published
Typed-array digital signal processing for FFTs, filters, convolution, resampling, and analysis.
Readme
@hecto/signal
Deterministic typed-array DSP kernels for FFTs, windows, filters, convolution, resampling, and spectral analysis.
pnpm add @hecto/signalimport { analysis, biquad } from '@hecto/signal'
const input = new Float32Array(128)
const output = new Float32Array(input.length)
const coefficients = biquad.design({
kind: 'lowpass',
freq: 1800,
q: 0.9,
sampleRate: 44_100,
})
biquad.process(input, coefficients, biquad.state(), output)
const level = analysis.rms(output)Hot-path APIs accept caller-owned output buffers, state, and reusable plans so allocation is explicit.
Output views must not overlap input or state views unless an API documents in-place
operation. window.apply, biquad.process, and onepole.process accept the exact
input view as output; window weights stay disjoint from output. Partial overlaps are
rejected before any samples or state change. Caller buffers must not alias reusable-plan
storage.
The FFT transforms operate in place, and rfftInto and irfftInto copy through their
plans' scratch storage. Other buffer-writing operations require disjoint views.
