A Few of My Favorite Sigmoids (2018) 27 points by bibyte 32 days ago | hide | past | web | favorite | 6 comments

 Don't forget the Gompertz function[1], used to model population growth:\$\$ g(x) = a e^{-b e^{-cx} } \$\$
 How does the function map to sound? I didn't see any discussion of that on the site.
 You take a damped sine wave, where its amplitude gradually moves towards zero, of some frequency and you pass it through the particular sigmoid function. Just like you can play a sine wave, you can play the resulting tone.If you look at his code, you can see how he wrote it:`````` fn gen_audio(len: usize) -> Vec { //(0..len).map(|i| ((i as f32).powi(2) * 1e-7).sin()).collect() let f = 440.0; let d = f / 44_100.0 * 2.0 * std::f64::consts::PI; (0..len).map(|i| { let i = i as f64; let amp = 100.0 * (i * -4e-5).exp(); let tone = (i * d).sin() * amp; tone.max(-1.0).min(1.0) as f32 //erf7(tone as f32) //(tone / (1.0 + tone * tone).sqrt()) as f32 //tone.tanh() as f32 }).collect() }``````
 Turn down the volume before playing the samples. Especially when wearing headphones.
 I've always loved sigmoids, a really simple beauty to them.

Search: