Table of Contents

Namespace NAudio.Dsp

Classes

BiQuadFilter

BiQuad filter

CrossfadingBiQuadFilter

Wraps two BiQuadFilter instances to retune a running filter without the click an in-place coefficient change causes. BiQuadFilter deliberately resets its state on every coefficient change (to recover from a divergent NaN/Inf run), so retuning it in place is discontinuous. Instead, reconfigure the Standby filter to the new settings, call BeginCrossfade(), and the output linearly crossfades from the old response to the new one over a short window.

DahdsrEnvelope

Six-stage DAHDSR (Delay, Attack, Hold, Decay, Sustain, Release) envelope generator. This generalises the four-stage EnvelopeGenerator with the extra Delay and Hold stages that SoundFont and SFZ instruments require, and a seconds-based API (stage durations are set in seconds rather than raw rates). The output is a linear amplitude/modulation multiplier in the range [0, 1].

The attack is convex (an exponential approach toward an over-shoot target), matching the SoundFont volume-envelope attack shape. Decay and release are constant-rate ramps following the SoundFont "time for a 100% change" semantic (SF2.04 §8.1.2): the stage time sets the ramp's rate, and the level the ramp runs to (the sustain level for decay, silence for release) truncates it, so a smaller change completes proportionally sooner. The ramp shape is selectable via DecayReleaseShape: exponential in amplitude (a constant fall in dB — the volume-envelope shape, gens 36/38) or linear in value (the modulation-envelope shape, gens 28/30). Designed for allocation-free real-time use.

DelayLine

A single-channel circular delay line with integer and fractional (linearly interpolated) taps. The building block for delay, chorus, flanger and reverb effects. Writes are denormal-flushed so a decaying feedback tail cannot stall the CPU on subnormal arithmetic.

DenormalGuard

Helpers for keeping denormalised (subnormal) floating-point values out of feedback paths. .NET exposes no portable flush-to-zero control, so feedback effects flush explicitly — subnormal arithmetic is otherwise orders of magnitude slower on most CPUs, which can stall an audio thread as a feedback tail decays.

EnvelopeFollower

Attack/release envelope follower (one-pole peak detector). The envelope rises towards the input magnitude with the attack time constant and falls with the release time constant. A core building block for dynamics processors (compressor, limiter, gate) and for synthesiser amplitude tracking. Allocation-free and denormal-safe.

EnvelopeGenerator

Envelope generator (ADSR)

FastFourierTransform

Summary description for FastFourierTransform.

FftProcessor

A reusable FFT processor specialised for fixed-size real-input audio work. Compared to calling FFT(bool, int, Complex[]) directly, this class:

  • Uses an N/2-point complex FFT plus an unpack pass to compute an N-point real FFT, returning an N/2 + 1-bin half-spectrum. Roughly half the work of the full complex FFT for the same N.
  • Precomputes the window coefficients (if configured) so the time-domain window is applied with one multiply per sample instead of a fresh cos evaluation.
  • Exposes Span<T> APIs so callers can pass stack-allocated or pooled buffers.
InterpolatingSampleReader

Reads a SampleSource at an arbitrary, per-sample-varying playback rate with interpolation, honouring the source's loop mode. This is the core pitch-shifting primitive of the sampler/synth: each voice owns one reader and supplies a playback increment (in source samples per output sample) that may change every sample under vibrato, pitch-bend or a pitch envelope. Unlike WdlResampler (a fixed-ratio block resampler), the increment is free to move continuously. Allocation-free in steady state.

Lfo

A bipolar (-1..+1) low-frequency oscillator for modulation (chorus, flanger, phaser, tremolo, auto-pan). Allocation-free; the sample-and-hold waveform uses a deterministic generator so output is reproducible.

LinkwitzRileyCrossover

Linkwitz–Riley 4th-order (24 dB/oct) crossover that splits a single channel into N contiguous bands at N-1 ascending crossover frequencies. Each split is two cascaded Butterworth biquads (LR4); a two-band split sums back to a magnitude-flat (all-pass) response. For more than two bands the split is serial, which carries a small recombination ripple — fine for band-wise dynamics, which is its purpose. A reusable building block for multiband compression and the de-esser.

Oversampler

Integer-factor (1×, 2× or 4×) oversampler for a single channel. Zero-stuffs and low-pass filters on the way up, low-pass filters and decimates on the way down, so a non-linear stage (saturation, clipping) can run at a higher rate where the alias products it generates fall above the original Nyquist and are filtered out. A factor of 1 is a transparent pass-through.

ParameterSmoother

One-pole exponential smoother for click-free parameter changes. Ramps a value towards a target with a configurable time constant, evaluated one sample at a time. Allocation-free.

PartitionedConvolver

Uniformly-partitioned overlap-save FFT convolution for a single channel. Convolves a real-time sample stream with a fixed impulse response of arbitrary length at a bounded, constant per-sample cost. The processing latency equals one partition (see LatencySamples); report it for delay compensation.

SampleSource

An immutable block of mono sample data plus the playback metadata a sampler voice needs: the playable extent, the loop points and the loop mode. The data is interpreted by an InterpolatingSampleReader. Pitch/root-key handling lives in the voice, not here — this type only describes the raw sample and how it loops.

SmbPitchShifter

SMB Pitch Shifter

SynthMath

Conversions between the musical / MIDI domain and the DSP domain that a sampler or synthesiser needs: note numbers, frequencies, cents, timecents and centibels. These are the units SoundFont generators and SFZ opcodes are expressed in, but the helpers are deliberately format-neutral so any instrument can share them.

TempoTime

Converts a NoteDivision at a given tempo into seconds or Hz.

VoiceActivityDetector

Energy-based voice activity detector with an adaptive noise floor and hangover. Operates on a mono sample stream in fixed analysis frames: a frame counts as speech when its level rises a configurable margin above the tracked noise floor, and the decision is held for a short hangover so word-final sounds are not clipped. Used to gate noise-estimate updates (noise suppression), freeze AGC during silence, or drive a transmit gate.

WdlResampler

Fully managed resampler, based on Cockos WDL Resampler

Structs

Complex

Type to represent complex number

Enums

DahdsrEnvelope.EnvelopeStage

Stages of the DAHDSR envelope.

DahdsrEnvelope.RampShape

The shape of the decay and release ramps (see DecayReleaseShape).

EnvelopeGenerator.EnvelopeState

Envelope State

FftWindowType

Window function to apply to time-domain samples before a forward real FFT.

InterpolationQuality

Interpolation quality for an InterpolatingSampleReader.

LfoWaveform

Low-frequency oscillator waveform.

LoopMode

Loop behaviour for a SampleSource.

NoteDivision

A musical note length, used to derive a time (for tempo-synced delays) or a rate (for tempo-synced modulation) from a tempo in BPM.