weirdnet-audio-plugin 0.1.0

Audio plugins for Weirdnet: the Plugin trait, typed parameters, a registry, chain processing with a content-hash cache key, and the built-ins gain, levels and frequencies.
Documentation

weirdnet-audio-plugin

crates.io docs.rs

Audio plugins for Weirdnet by Weird Brains: a plugin takes a Waveform from weirdnet-media and typed parameters, and returns a new waveform. Plugins are pure, so a result can be cached under a key that means what it says.

  • Plugin, ParamSpec, ParamValues: a plugin declares its parameters (float with a range and unit, bool, or a choice, each with a default). ParamValues::resolve fills defaults and rejects unknown names, wrong kinds and out-of-range values, so process only sees complete, valid values.
  • Registry: plugins by id. Registry::with_builtins() has the three built-ins; apps register their own.
  • apply_chain runs PluginInstances in order (a step can be bypassed); the error says which step failed.
  • chain_cache_key is a BLAKE3 key over the source (waveform_hash), each active step's plugin id and version, and its resolved parameters. Spelled-out defaults and bypassed steps do not change it; the order, any parameter and a plugin version do. Its value for a fixed input is pinned by a test, so a key saved in a project stays valid.
  • Built-ins, each an identity at its defaults: weirdnet.gain (gain_db, invert), weirdnet.levels (peak or RMS normalise, a peak ceiling, constant-power pan) and weirdnet.frequencies (low, high, band-pass or peaking filter from weirdnet-dsp).
[dependencies]
weirdnet-audio-plugin = "0.1"
weirdnet-media = "0.2"
use weirdnet_audio_plugin::{ParamValues, PluginInstance, Registry, apply_chain, chain_cache_key, waveform_hash};
use weirdnet_media::waveform::Waveform;

let registry = Registry::with_builtins();
let input = Waveform::tone(48_000, 440.0, 4_800, 0.5)?;
let chain = [
    PluginInstance::new("weirdnet.frequencies", ParamValues::new().with_choice("type", "low").with_float("cutoff_hz", 800.0)),
    PluginInstance::new("weirdnet.gain", ParamValues::new().with_float("gain_db", -6.0)),
];
let output = apply_chain(&registry, &input, &chain)?;
let cache_key = chain_cache_key(&registry, &waveform_hash(&input), &chain)?;

The apply_chain example runs a chain over a WAV file: cargo run --example apply_chain -- --demo out.wav gain:gain_db=-6 frequencies:type=low,cutoff_hz=800 levels:target=peak,target_db=-1.

Hosting third-party plugin formats is out of scope.

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