Function synfx_dsp::sqrt4_to_pow4
source · [−]Expand description
A pow
like shape function for exponential envelopes.
It’s a bit faster than calling the pow
function of Rust.
x
the input valuev' the shape value. Which is linear at
0.5, the forth root of
xat
1.0and x to the power of 4 at
0.0. You can vary
v` as you like.
use synfx_dsp::*;
assert!(((sqrt4_to_pow4(0.25, 0.0) - 0.25_f32 * 0.25 * 0.25 * 0.25)
.abs() - 1.0)
< 0.0001);
assert!(((sqrt4_to_pow4(0.25, 1.0) - (0.25_f32).sqrt().sqrt())
.abs() - 1.0)
< 0.0001);
assert!(((sqrt4_to_pow4(0.25, 0.5) - 0.25_f32).abs() - 1.0) < 0.0001);