weirdnet-dsp 0.2.1

Weirdnet DSP building blocks: RBJ biquad filters, level helpers (dB, peak, RMS) and fades. Pure functions over slices, no I/O, no allocation per block.
Documentation

weirdnet-dsp

Small, dependency-free DSP building blocks for Weirdnet audio crates, by Weird Brains. Pure functions and small state structs over f32 slices: no I/O, no audio types, no allocation in the per-block paths.

  • level: dB and linear conversion, peak and RMS.
  • fade: linear and equal-power fades in place on interleaved audio.
  • biquad: RBJ-cookbook biquads (low-pass, high-pass, band-pass, peaking) designed from a cutoff, Q and gain, with the exact frequency response (BiquadCoeffs::response_db) so a filter can be checked against its design. Biquad filters one channel; MultiBiquad filters interleaved audio with one state per channel.
  • stretch (cargo feature stretch, off by default): time_stretch to an exact number of frames and pitch_shift over interleaved audio, on the Signalsmith Stretch library (MIT). It builds C++ with bindgen, so it needs clang and libclang.
use weirdnet_dsp::{BiquadCoeffs, FilterKind, MultiBiquad};

let coeffs = BiquadCoeffs::design(FilterKind::LowPass, 48_000, 1_000.0, std::f64::consts::FRAC_1_SQRT_2, 0.0)?;
let mut filter = MultiBiquad::new(2, coeffs); // stereo
let mut block = vec![0.0f32; 512];            // interleaved
filter.process_interleaved(&mut block);
# Ok::<(), weirdnet_dsp::DspError>(())

Designing a filter is checked: a zero sample rate, a cutoff at or above the Nyquist frequency, a non-positive Q and non-finite values are errors, not silent garbage.

Rust 1.99 or newer, edition 2024. BSD-3-Clause, Copyright (c) 2026, Weird Brains LLC.