|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
A soft-knee limiter: the input under a knee, a tanh bend under a ceiling above it. More...
A soft-knee limiter: the input under a knee, a tanh bend under a ceiling above it.
Memoryless. A sample whose magnitude is at or under the knee passes unchanged, bit for bit. Above it the excess is bent by a tanh scaled to the room between the knee and the ceiling, so the curve leaves the knee at a slope of 1 and approaches the ceiling without reaching past it. A NaN comes out as 0. Below the signal transport (signal-transport section 5.6): the knee and the ceiling are in the signal's own scale, 0 < knee < ceiling, fixed at construction, and it declares no ports.
While a signal is above the knee the bend adds harmonics, which are not band-limited; set the knee above the level the signal has in normal use.
Definition at line 36 of file soft_limiter.hpp.
#include <soft_limiter.hpp>
Public Member Functions | |
| constexpr | SoftLimiter (float knee, float ceiling) |
| A limiter with a knee and a ceiling, 0 < knee < ceiling. | |
| constexpr float | knee () const |
| The knee. | |
| constexpr float | ceiling () const |
| The ceiling. | |
| bool | acts_on (float x) const |
| Whether limit() changes x: its magnitude is above the knee, or it is not a number. | |
| float | limit (float x) const |
| One sample through the limiter. | |
| void | process (const float *in, float *out, uint16_t frames) const |
A block through the limiter; out may be in. | |
|
inlineconstexpr |
A limiter with a knee and a ceiling, 0 < knee < ceiling.
| knee | The magnitude up to which the input passes unchanged |
| ceiling | The magnitude the output does not exceed |
Definition at line 44 of file soft_limiter.hpp.
|
inlineconstexpr |
The knee.
Definition at line 47 of file soft_limiter.hpp.
|
inlineconstexpr |
The ceiling.
Definition at line 49 of file soft_limiter.hpp.
|
inline |
Whether limit() changes x: its magnitude is above the knee, or it is not a number.
| x | Input sample |
Definition at line 57 of file soft_limiter.hpp.
References sbl::math::magnitude_bits().
Referenced by limit().
|
inline |
One sample through the limiter.
| x | Input sample, any value |
Definition at line 66 of file soft_limiter.hpp.
References acts_on(), and sbl::dsp::math::fast_tanhf().
Referenced by process().
|
inline |
A block through the limiter; out may be in.
| in | Input buffer, frames long | |
| [out] | out | Output buffer, frames long |
| frames | Frame count |
Definition at line 86 of file soft_limiter.hpp.
References limit().