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

Delay, Haas

Download

     Disclaimer...

23   desc:Delay [Haas], v1.0.0
24  
25   slider1:67<-250,250,1>Delay [samples]
26   slider2:0<0,1,1>Mono/Stereo
27  
28   @init
29   buf = 0;
30   bufposR = 0;
31   delay = 67;
32   bufposW = delay;
33   buflength = 250;
34   stereo = 0;
35  
36   @slider
37   delay = slider1;
38   bufposR = bufposW - delay;
39   bufposR < 0 ? bufposR = bufPosR + buflength;
40   stereo = slider2;
41  
42   @sample
43   stereo < 1 ? (
44   mono = ( spl0 + spl1 ) / 2.0;
45   spl0 = mono;
46   spl1 = mono;
47   );
48  
49   delay == 0 ? (
50   spl0 = spl0;
51   spl1 = spl1;
52   ) :
53   (
54   delay > 0 ? (
55   x = spl0;
56   spl0 = buf[bufposR];
57   buf[bufposW] = x;
58   spl1 = spl1;
59   ) :
60   (
61   x = spl1;
62   spl1 = buf[bufposR];
63   buf[bufposW] = x;
64   spl0 = spl0;
65   );
66  
67   bufposR = bufposR + 1 ;
68   bufposR > buflength ? bufposR = 0;
69   bufposW = bufposW + 1 ;
70   bufposW > buflength ? bufposW = 0;

Download