Skip to content

Instantly share code, notes, and snippets.

@mtytel
Created October 31, 2018 16:07
Show Gist options
  • Save mtytel/e7e90604fa38bad60a512aac55c9e261 to your computer and use it in GitHub Desktop.
Save mtytel/e7e90604fa38bad60a512aac55c9e261 to your computer and use it in GitHub Desktop.
clipped exponential power scale
float powerScale(mono_float value, mono_float power) {
static constexpr float kMinPower = 0.01f;
if (fabsf(power) < kMinPower)
return value;
float numerator = mopo::futils::exp(power * value) - 1.0f;
float denominator = mopo::futils::exp(power) - 1.0f;
return numerator / denominator;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment