Skip to main content

Crate weirdnet_dsp

Crate weirdnet_dsp 

Source
Expand description

Weirdnet DSP building blocks. Pure functions and small state machines over f32 slices: no I/O, no allocation in the per-block paths (Biquad::process, MultiBiquad::process_interleaved, the fades and the level helpers).

  • level: dB and linear conversion, peak and RMS.
  • fade: fade curves and in-place fades on interleaved audio.
  • stretch (feature stretch): time stretch and pitch shift over Signalsmith Stretch.
  • biquad: RBJ-cookbook biquad filters (low-pass, high-pass, band-pass, peaking) with a frequency-response check.
  • resample: streaming sample-rate conversion (windowed sinc) with a fine ratio trim for following another clock.
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, interleaved
let mut block = vec![0.0f32; 512];
filter.process_interleaved(&mut block);

Re-exports§

pub use biquad::Biquad;
pub use biquad::BiquadCoeffs;
pub use biquad::DspError;
pub use biquad::FilterKind;
pub use biquad::MultiBiquad;
pub use fade::FadeCurve;
pub use fade::fade_in;
pub use fade::fade_out;
pub use level::db_to_linear;
pub use level::linear_to_db;
pub use level::peak;
pub use level::rms;

Modules§

biquad
Biquad filters from the RBJ audio-EQ cookbook (direct form II transposed, f64 state).
fade
Fades on interleaved audio, in place.
level
Level helpers: dB conversion, peak and RMS.
resample
Streaming sample-rate conversion with a windowed-sinc kernel, and a fine ratio trim for following another device’s clock.