Pan, Delay

Download

     Disclaimer...

28   desc:Pan: Delay, v1.1.0
29  
30   slider1:0<-72,72,1>Buffer Length [samples]
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  
41   @slider
42   delay = slider1;
43   d = delay;
44   d < 0 ? d = d * -1; // absolute value
45   bufposR = bufposW - d;
46   bufposR < 0 ? bufposR = bufPosR + buflength;
47  
48  
49   @sample
50   delay == 0 ? (
51   spl0=spl0;
52   spl1=spl1;
53   ) : (
54   delay < 0 ? (
55   x = spl1;
56   spl1 = buf[bufposR];
57   buf[bufposW] = x;
58   bufposR = bufposR + 1 ;
59   bufposR > buflength ? bufposR = 0;
60   bufposW = bufposW + 1 ;
61   bufposW > buflength ? bufposW = 0;
62  
63   spl0 = spl0;
64  
65   ) : (
66   x = spl0;
67   spl0 = buf[bufposR];
68   buf[bufposW] = x;
69   bufposR = bufposR + 1 ;
70   bufposR > buflength ? bufposR = 0;
71   bufposW = bufposW + 1 ;
72   bufposW > buflength ? bufposW = 0;
73  
74   spl1 = spl1;
75   );
76   );
77  

Download