Dynamic Smoother
Overview
The dynamic_smoother
class is based on Dynamic Smoothing Using Self Modulating Filter (© Andrew Simper, Cytomic, 2014, andy@cytomic.com), a robust and inexpensive dynamic smoothing algorithm based on using the bandpass output of a 2-pole multimode filter to modulate its own cutoff frequency. The bandpass signal dynamically adjusts the cutoff frequency to provide faster tracking when the input signal changes significantly. It is ideal for de-noising and smoothing operations, such as for analog potentiometers or MIDI controllers, but is also useful in cleaning up audio signals for analytical processes such as pitch detection.
Response
The blue trace (Figure 1) is the original signal, the orange trace (Figure 2) is the signal processed by the dynamic smoother with a base cutoff freqeuency at twice the fundamental frequency of the signal, and for comparison, the green trace (Figure 2) is the signal processed by a one-pole lowpass filter using the same cutoff frequency.
Notice that, compared to the one-pole lowpass filter, the dynamic smoother responds more quickly to rapid changes in the input signal, such as sharp peaks. But for slower changes, such as the signal near the center, the dynamic smoother and the one-pole lowpass filter have similar outputs.
Declaration
struct dynamic_smoother
{
dynamic_smoother(
frequency base
, float sps
);
dynamic_smoother(
frequency base
, float sensitivity
, float sps
);
float operator()(float s);
dynamic_smoother& operator=(float y);
void base_frequency(frequency base, float sps);
};
Expressions
Notation
ds
,a
,b
-
Objects of type
dynamic_smoother
. f
-
Object of type
frequency
representing the base cutoff frequency. sps
-
Floating point value representing samples per second.
sens
-
Floating point value representing sensitivity.
s
-
Input sample.
Constructors and Assignment
Expression | Semantics |
---|---|
|
Construct a |
|
Construct a |
|
Copy construct a |
|
Assign |
|
Set the latest result to |
C++ brace initialization may also be used. |