pub fn sqrt4_to_pow4(x: f32, v: f32) -> f32
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 value
  • v' the shape value. Which is linear at 0.5, the forth root of xat1.0and x to the power of 4 at0.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);