Table of Contents

Class ParameterSmoother

Namespace
NAudio.Dsp
Assembly
NAudio.Core.dll

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.

public sealed class ParameterSmoother
Inheritance
ParameterSmoother
Inherited Members

Properties

Current

The most recent smoothed value.

public float Current { get; }

Property Value

float

IsSettled

True when the smoothed value has effectively reached the target.

public bool IsSettled { get; }

Property Value

bool

Target

The value the smoother is ramping towards.

public float Target { get; }

Property Value

float

Methods

Configure(int, float)

Sets the sample rate and smoothing time and recomputes the one-pole coefficient. Does not change the current or target value.

public void Configure(int sampleRate, float smoothingMilliseconds = 10)

Parameters

sampleRate int

Sample rate in Hz. Must be positive.

smoothingMilliseconds float

Approximate time to converge towards a new target. Must be positive.

Process()

Advances one sample and returns the next smoothed value.

public float Process()

Returns

float

Reset(float)

Immediately jumps the current and target value, with no ramp.

public void Reset(float value)

Parameters

value float

SetTarget(float)

Sets the target the smoother ramps towards.

public void SetTarget(float value)

Parameters

value float