Distortion, Crossover

Download

     Disclaimer...

23   desc:Distortion, Crossover, v1.0.0
24  
25   slider1:0.05<0,0.1,0.001>Threshold
26   slider2:1<1,10,0.01>Linear Gain
27  
28   @init
29   thresh = 0.05;
30   gain = 0;
31  
32   @slider
33   thresh = slider1;
34   gain = slider2;
35  
36   @sample
37   spl0 = spl0;
38   spl0 > 0 ? (
39   input -= th;
40   ) : (
41   input += th;
42   );
43  
44   spl0 < thresh ? (
45   spl0 > -thresh ? (
46   spl0 = spl0 * gain;
47   );
48   );
49  

Download

Distortion, Non-Linear, µLaw

Download

     Disclaimer...

23   desc:Distortion: Non-Linearity, µLaw, v1.0.0
24  
25   slider1:0<0,1.0,0.01>µ
26   slider2:0<0,1.0,0.01>gain
27  
28   @init
29   mu = 0;
30   gain = 1.0;
31  
32   @slider
33   mu = slider1 * 4; // 255
34   gain = slider2;
35  
36   @sample
37   mu > 0 ? (
38   spl0 < 0 ? (
39   spla = -(log(1 + (mu * -spl0)) / log(1 + mu));
40   ) : (
41   spla = (log(1 + (mu * spl0)) / log(1 + mu));
42   );
43   ) : ( spla = spl0; );
44   spl0 = spla * gain;
45  

Download

Distortion, Rectifier, Full-Wave

Download

     Disclaimer...

23   desc:Distortion: Rectifier, Full-Wave, v1.0.0
24  
25   slider1:0.5<0,2.0,0.01>Linear Gain
26  
27   @init
28   gain = 1.0;
29  
30   @slider
31   gain = slider1;
32  
33   @sample
34   spl0 < 0 ? ( spla = -spl0; ) : ( spla = spl0; );
35   spl0 = spla * gain;
36  

Download

Delay, Ring Buffer [Stereo]

Download

     Disclaimer...

23   desc:Ring Buffer [2ch], v1.0.0
24  
25   slider1:50<1,500,1>Buffer Length [ms]
26  
27   @init
28   buf = 0; // buffer exists at offset 0
29   bufposR = 0;
30   delay = srate * 0.05; // 50 ms
31   bufposW = delay;
32   buflength = srate * 0.5; // 500 ms
33   buf2 = buflength; // buffer2 exists at offset 22050
34  
35   @slider
36   delay = srate * slider1 / 1000.0; // # of samples
37   bufposR = bufposW - delay;
38   bufposR < 0 ? bufposR = bufPosR + buflength;
39  
40   @sample
41   x = spl0;
42   spl0 = buf[bufposR];
43   buf[bufposW] = x;
44  
45   // delays both channels by same amount, no mix
46   x = spl1;
47   spl1 = buf2[bufposR];
48   buf2[bufposW] = x;
49  
50   bufposR = bufposR + 1 ;
51   bufposR > buflength ? bufposR = 0;
52   bufposW = bufposW + 1 ;

Download

Delay, Basic Ring Buffer

Download

     Disclaimer...

23   desc:Ring Buffer [mono], v1.0.0
24  
25   slider1:50<1,500,1>Buffer Length [ms]
26  
27   @init
28   buf = 0; // buffer exists at offset 0
29   bufposR = 0;
30   delay = srate * 0.05; // 50 ms
31   bufposW = delay;
32   buflength = srate * 0.5; // 500 ms
33  
34   @slider
35   delay = srate * slider1 / 1000.0; // # of samples
36   bufposR = bufposW - delay;
37   bufposR < 0 ? bufposR = bufPosR + buflength;
38  
39   @sample
40   x = spl0;
41   spl0 = buf[bufposR];
42   buf[bufposW] = x;
43   bufposR = bufposR + 1 ;
44   bufposR > buflength ? bufposR = 0;
45   bufposW = bufposW + 1 ;
46   bufposW > buflength ? bufposW = 0;
47  
48   // only delays one channel - will not mix

Download

Delay, Stereo

Download

     Disclaimer...

23   desc:Delay [2ch], v1.0.0
24  
25   slider1:50<1,500,1>Delay [ms]
26   slider2:0.5<0,1,0.01>Wet/Dry [%]
27   slider3:0<-1,1,0.01>Feedback [%]
28  
29   @init
30   buf = 0; // buffer exists at offset 0
31   bufposR = 0;
32   delay = srate * 0.05; // 50 ms
33   bufposW = delay;
34   buflength = srate * 0.5; // 500 ms
35   buf2 = buflength; // buffer2 exists at offset 22050 @ Fs 44.1 kHz
36   m = 0.5;
37   f = 0;
38  
39   @slider
40   delay = srate * slider1 / 1000.0; // # of samples
41   bufposR = bufposW - delay;
42   bufposR < 0 ? bufposR = bufPosR + buflength;
43   m = slider2;
44   f = slider3;
45  
46   @sample
47   x = spl0;
48   spl0 = buf[bufposR] * (1 - m) + x * m;;
49   buf[bufposW] = x + ( buf[bufposR] * f );
50  
51   x = spl1;
52   spl1 = buf2[bufposR] * (1 - m) + x * m;;
53   buf2[bufposW] = x + ( buf2[bufposR] * f );
54  
55   bufposR = bufposR + 1 ;
56   bufposR > buflength ? bufposR = 0;
57   bufposW = bufposW + 1 ;

Download

Pan, Delay Pro

Download

     Disclaimer...

27   desc:Pan: Delay Pro, v1.1.0
28  
29   slider1:0<-72,72,1>Buffer Length [samples]
30   slider2:0<0,10,0.1>Max Attenuation [dB]
31  
32  
33   @init
34   buf = 0; // buffer exists at offset 0
35   bufposR = 0;
36   delay = 0;
37   bufposW = delay;
38   buflength = 72; // good value for headphones
39   // may not be ideal for speakers
40   m = 1.0;
41  
42  
43   @slider
44   delay = slider1;
45   d = delay;
46   d < 0 ? d = d * -1; // absolute value
47   bufposR = bufposW - d;
48   bufposR < 0 ? bufposR = bufPosR + buflength;
49  
50   b = abs((slider1) / 72);
51   c = -b * slider2; // scale; no att. at 12:00
52   m = pow(10, (c /20));
53  
54  
55   @sample
56   delay == 0 ? (
57   spl0=spl0;
58   spl1=spl1;
59   ) : (
60   delay < 0 ? (
61   x = spl1;
62   spl1 = buf[bufposR] *= m;
63   buf[bufposW] = x;
64   bufposR = bufposR + 1 ;
65   bufposR > buflength ? bufposR = 0;
66   bufposW = bufposW + 1 ;
67   bufposW > buflength ? bufposW = 0;
68  
69   spl0 = spl0;
70  
71   ) : (
72   x = spl0;
73   spl0 = buf[bufposR] *= m;
74   buf[bufposW] = x;
75   bufposR = bufposR + 1 ;
76   bufposR > buflength ? bufposR = 0;
77   bufposW = bufposW + 1 ;
78   bufposW > buflength ? bufposW = 0;
79  
80   spl1 = spl1;
81   );
82   );
83  

Download

Pan, Lo Pass Pro

Download

     Disclaimer...

27   desc:Pan: Lo Pass Pro, v1.1.0
28  
29   slider1:0<-120,120,0.1>Pan Angle [degrees]
30   slider2:0<0,10,0.1>Max Attenuation [dB]
31  
32   @init
33   x=0;
34   x1=0;
35   x2=0;
36   y=0;
37   y1=0;
38   y2=0;
39   d=1.414;
40   who = 0;
41  
42   m = 1;
43  
44  
45   @slider
46   who = slider1;
47   f = slider1 * 60/120; // 0 < f < 60
48   f > 0 ? f = f * -1; // -60 < f < 0
49   dd = pow(2, f/8.0)*16000; // 16,000 -> 500 Hz
50   w = 2.0 * $pi * dd / srate;
51   mBeta = 0.5 * (( 1.0 - d / 2.0 * sin(w) ) / ( 1.0 + d / 2.0 * sin(w) ));
52   mGamma = ( 0.5 + mBeta ) * cos(w);
53   mAlpha = ( 0.5 + mBeta - mGamma ) / 4.0;
54  
55   b = abs((slider1) / 72);
56   c = -b * slider2; // scale; no att. at 12:00
57   m = pow(10, (c /20));
58  
59  
60   @sample
61   who == 0 ? (
62   spl0=spl0;
63   spl1=spl1;
64   ) : (
65   who < 0 ? (
66   x = spl1;
67   y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
68   x2 = x1;
69   x1 = x;
70   y2 = y1;
71   y1 = y;
72   spl1 = y *= m;
73   spl0 = spl0;
74  
75   ) : (
76   x = spl0;
77   y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
78   x2 = x1;
79   x1 = x;
80   y2 = y1;
81   y1 = y;
82   spl0 = y *= m;
83   spl1 = spl1;
84   );
85   );
86  

Download

Pan, Lo Pass

Download

     Disclaimer...

29   desc:Pan: Lo Pass, v1.1.0
30  
31   slider1:0<-120,120,0.1>Pan Angle [degrees]
32  
33   @init
34   x=0;
35   x1=0;
36   x2=0;
37   y=0;
38   y1=0;
39   y2=0;
40   d=1.414;
41   who = 0;
42  
43   @slider
44   who = slider1;
45   f = slider1 * 60/120; // 0 < f < 60
46   f > 0 ? f = f * -1; // -60 < f < 0
47   dd = pow(2, f/8.0)*16000; // 16,000 -> 500 Hz
48   w = 2.0 * $pi * dd / srate;
49   mBeta = 0.5 * (( 1.0 - d / 2.0 * sin(w) ) / ( 1.0 + d / 2.0 * sin(w) ));
50   mGamma = ( 0.5 + mBeta ) * cos(w);
51   mAlpha = ( 0.5 + mBeta - mGamma ) / 4.0;
52  
53   @sample
54   who == 0 ? (
55   spl0=spl0;
56   spl1=spl1;
57   ) : (
58   who < 0 ? (
59   x = spl1;
60   y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
61   x2 = x1;
62   x1 = x;
63   y2 = y1;
64   y1 = y;
65   spl1 = y;
66   spl0 = spl0;
67  
68   ) : (
69   x = spl0;
70   y = 2.0 * ( mAlpha * ( x + 2.0 * x1 + x2 ) + mGamma * y1 - mBeta * y2 );
71   x2 = x1;
72   x1 = x;
73   y2 = y1;
74   y1 = y;
75   spl0 = y;
76   spl1 = spl1;
77   );
78   );
79  

Download