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.
xthe input valuev' the shape value. Which is linear at0.5, the forth root ofxat1.0and x to the power of 4 at0.0. You can varyv` 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);