meadow-dsp-essentials 0.1.4

Liberally-licensed essential audio DSP library used in the Meadowlark DAW project
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[cfg(not(feature = "std"))]
use num_traits::Float;

// TODO: Add a portable-simd version of this
/// A `tanh` approximation by Raph Levien
#[inline]
pub fn tanh_levien(x: f64) -> f64 {
    let x2 = x * x;
    let x3 = x2 * x;
    let x5 = x3 * x2;

    let a = x + (0.16489087 * x3) + (0.00985468 * x5);

    a / (1.0 + (a * a)).sqrt()
}