Table of Contents

Class BitCrusherEffect

Namespace
NAudio.Effects
Assembly
NAudio.Core.dll

Lo-fi bit crusher: reduces amplitude resolution (bit depth) and, optionally, the effective sample rate by sample-and-hold decimation down to a chosen target rate. The decimation deliberately aliases (the classic gritty bitcrusher character); enable Smoothing for a softer, more "vintage" tone. Per-channel state keeps a stereo image coherent.

public sealed class BitCrusherEffect : AudioEffect, IAudioEffect, IParameterized
Inheritance
BitCrusherEffect
Implements
Inherited Members

Properties

BitDepth

Quantisation resolution in bits, 1–32. Default 8.

public int BitDepth { get; set; }

Property Value

int

Parameters

Generic parameter list (excludes Bypass/Mix, which are on the base).

public IReadOnlyList<EffectParameter> Parameters { get; }

Property Value

IReadOnlyList<EffectParameter>

Smoothing

When true, a one-pole low-pass softens the decimated signal (less aliasing, smoother "vintage" tone) instead of the raw gritty sample-and-hold. Default false.

public bool Smoothing { get; set; }

Property Value

bool

TargetSampleRate

Target effective sample rate in Hz. The signal is sample-and-hold decimated to the nearest integer division of the host rate. 0 (or any value at/above the host rate) disables sample-rate reduction. Default 22050 Hz.

public int TargetSampleRate { get; set; }

Property Value

int

Methods

OnConfigure(WaveFormat)

Called by Configure(WaveFormat) after the format is stored. Derived effects allocate and size their sample-rate-dependent state here.

protected override void OnConfigure(WaveFormat format)

Parameters

format WaveFormat

ProcessBlock(Span<float>)

Transforms buffer in place into the fully-wet signal. The base class handles dry/wet mixing and bypass around this call.

protected override void ProcessBlock(Span<float> buffer)

Parameters

buffer Span<float>

Reset()

Clears internal state (delay lines, envelopes, smoothers) so the next block starts as if from silence.

public override void Reset()