Distortion, Clipping [A] Soft

Download

     Disclaimer...

23   desc:Distortion: Soft Clipping, A, v1.0.0
24  
25   slider1:0.5<0,1.0,0.01>Linear Gain
26  
27   @init
28   thresh1 = 1.0/3.0;
29   thresh2 = 2.0/3.0;
30   gain = 0.5;
31  
32   @slider
33   gain = 2 * slider1; // +6 dB
34  
35   @sample
36   spl0 = spl0 * gain;
37   spl0 > thresh1 ? (
38   spl0 > thresh2 ? (
39   spl0 = 1.0;
40   ) : (
41   spl0 = (3.0 - (2.0 - 3.0*spl0)*(2.0 - 3.0*spl0)) / 3.0;
42   );
43   );
44   spl0 < -thresh1 ? (
45   spl0 < -thresh2 ? (
46   spl0 = -1.0;
47   ) : (
48   spl0 = - (3.0 - (2.0 + 3.0*spl0)*(2.0 + 3.0*spl0)) / 3.0;
49   );
50   );
51  
52   spl1 = spl1;
53  

Download