|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
A one-pole low-pass, exact for an input that holds through the frame. More...
A one-pole low-pass, exact for an input that holds through the frame.
y += k (x - y) per frame, with k = 1 - e^(-2 pi fc) for a cutoff fc in cycles per frame: the low-pass whose response to an input that holds through the frame is exact, y(t) = x + (y(0) - x) e^(-2 pi fc t). The same form holds over any time, so coefficient_for(cutoff, frames) gives the coefficient for a part of a frame or for several, and process(x, coefficient) advances by that time toward a held input. An owner that knows when its input stepped within a frame can advance to the step and on from it, and so follow the input itself instead of samples of it.
Below the signal transport: the cutoff is in cycles per frame, set by the component or app that owns it; it holds no sample rate. It declares no ports; the buffer call takes none, and PARAMETERS names the cutoff so a tool can run it alone. A non-finite or negative cutoff or time gives a coefficient of 0, where the output holds. The input is not tested, as DcBlock's is not: a non-finite input stays in the state until reset(), and its owner keeps it out. Until a cutoff is set the coefficient is 1, and the output follows the input.
Definition at line 38 of file one_pole.hpp.
#include <one_pole.hpp>
Public Member Functions | |
| void | set_cutoff (float cycles_per_frame) |
| Set the cutoff for the one-frame calls. | |
| float | process (float x) |
| One frame. | |
| float | process (float x, float coefficient) |
An advance by the time coefficient was worked for, toward an input that holds through it. | |
| void | process (const float *in, float *out, uint16_t frames) |
| A buffer of frames. In place is fine: out may be in. | |
| void | reset (float value=0.0f) |
| The output jumps to a value. | |
| float | value () const |
| The current output. | |
| float | coefficient () const |
| The coefficient the one-frame calls use. | |
Static Public Member Functions | |
| static float | coefficient_for (float cutoff_cycles_per_frame, float frames=1.0f) |
| The coefficient for a cutoff over a time: 1 - e^(-2 pi cutoff frames), in [0, 1). | |
Static Public Attributes | |
| static constexpr transport::Parameter< OnePole > | PARAMETERS [] |
| The parameters, for tools. | |
|
inlinestatic |
The coefficient for a cutoff over a time: 1 - e^(-2 pi cutoff frames), in [0, 1).
| cutoff_cycles_per_frame | The corner, in cycles per frame |
| frames | The time one process() call covers, in frames; 1 by default |
Definition at line 47 of file one_pole.hpp.
References sbl::math::TWO_PI.
Referenced by set_cutoff().
|
inline |
Set the cutoff for the one-frame calls.
| cycles_per_frame | Cutoff in cycles per frame; a non-finite or non-positive value holds the output |
Definition at line 61 of file one_pole.hpp.
References coefficient_for().
|
inline |
One frame.
| x | Input sample |
Definition at line 70 of file one_pole.hpp.
References process().
|
inline |
An advance by the time coefficient was worked for, toward an input that holds through it.
| x | Input, held through the advance |
| coefficient | A coefficient from coefficient_for(), in [0, 1) |
Definition at line 80 of file one_pole.hpp.
References coefficient().
|
inline |
A buffer of frames. In place is fine: out may be in.
| in | Input buffer, frames long | |
| [out] | out | Output buffer, frames long |
| frames | Frame count |
Definition at line 98 of file one_pole.hpp.
References process().
|
inline |
The output jumps to a value.
| value | New output; a non-finite value gives 0 |
Definition at line 109 of file one_pole.hpp.
References value().
|
inline |
|
inline |
The coefficient the one-frame calls use.
Definition at line 114 of file one_pole.hpp.
Referenced by process().
|
staticconstexpr |
The parameters, for tools.
Definition at line 86 of file one_pole.hpp.