Expand description
§naad — Audio Synthesis Primitives
naad (Sanskrit: primordial sound/vibration) provides foundational audio synthesis building blocks: oscillators, filters, envelopes, wavetables, modulation, delay lines, effects, noise generators, and tuning utilities.
Part of the AGNOS ecosystem. Consumed by dhvani (sound engine) and svara (music composition).
§Architecture
All processing methods work on contiguous &mut [f32] slices. Hot-path
methods (next_sample, process_sample) are #[inline] for cross-crate
optimization. Buffer methods (fill_buffer, process_buffer) iterate
over slices, enabling SIMD auto-vectorization when compiled with
appropriate target features (-C target-cpu=native).
dhvani (the sound engine) handles buffer alignment and SIMD dispatch. naad provides the scalar reference implementations.
§Quick Start
use naad::oscillator::{Oscillator, Waveform};
use naad::envelope::Adsr;
use naad::filter::{BiquadFilter, FilterType};
// Create a 440 Hz sine oscillator
let mut osc = Oscillator::new(Waveform::Sine, 440.0, 44100.0).unwrap();
// Create an ADSR envelope
let mut env = Adsr::new(0.01, 0.1, 0.7, 0.3).unwrap();
// Create a low-pass filter at 2kHz
let mut filter = BiquadFilter::new(FilterType::LowPass, 44100.0, 2000.0, 0.707).unwrap();
// Generate a sample
env.gate_on();
let sample = osc.next_sample() * env.next_value();
let filtered = filter.process_sample(sample);§Feature Flags
default— All core primitives (oscillators, filters, envelopes, effects, dynamics, EQ, reverb, voice, mod matrix, panning, smoothing, tuning, noise, delay, wavetable, dsp_util)synthesis— Synthesis algorithm modules (subtractive, FM, drum, formant, additive, vocoder, granular, physical modeling)acoustics— Room simulation, convolution reverb, binaural, FDN, analysis, ambisonics (via goonj)logging— Enable tracing-subscriber for structured logging outputfull— All features enabled
Re-exports§
Modules§
- delay
- Delay lines, comb filters, and allpass delay networks.
- dsp_
util - DSP utility functions: dB conversion, clipping, interpolation.
- dynamics
- Dynamics processors: compressor, limiter, and noise gate.
- effects
- Audio effects: chorus, flanger, phaser, and distortion.
- envelope
- ADSR envelope generator and multi-stage envelopes.
- eq
- Parametric and graphic equalizers.
- error
- Error types for the naad synthesis crate.
- filter
- Biquad and state variable filters.
- mod_
matrix - Modulation matrix for flexible source-to-destination routing.
- modulation
- Modulation sources: LFO, FM synthesis, and ring modulation.
- noise
- Noise generators: white, pink (Voss-McCartney), and brown noise.
- oscillator
- Oscillator module with band-limited waveform generation.
- panning
- Stereo panning utilities.
- reverb
- Algorithmic reverb based on the Schroeder topology.
- smoothing
- Parameter smoothing for click-free transitions.
- synth
- Synthesis algorithm modules.
- tuning
- Tuning and pitch utilities.
- voice
- Voice management for polyphonic synthesis.
- wavetable
- Wavetable synthesis with morphing support.
Functions§
- flush_
denormal - Flush denormal floating-point values to zero.