44 return x * (27.0f + x2) / (27.0f + 9.0f * x2);
55 if (x < -3.0f) x = -3.0f;
56 if (x > 3.0f) x = 3.0f;
72 constexpr float INV_MAX = 1.0f /
static_cast<float>(
SAMPLE_MAX_24);
73 float f =
static_cast<float>(x) * INV_MAX;
75 if (f < -3.0f) f = -3.0f;
76 if (f > 3.0f) f = 3.0f;
78 return static_cast<int32_t
>(sat *
static_cast<float>(
SAMPLE_MAX_24));
DSP atoms for audio signal processing.
float soft_limit(float x)
Smooth saturation with unity gain at origin.
int32_t soft_clip_24(int32_t x)
Soft saturation for 24-bit audio samples.
float soft_clip(float x)
Bounded soft clipper — output in [-1, 1].
constexpr int32_t SAMPLE_MAX_24