1 2/* Stereo delay with feedback. */ 3 4declare name "echo -- stereo delay effect"; 5declare author "Albert Graef"; 6declare version "1.0"; 7 8import("music.lib"); 9 10level = hslider("level", 1, 0, 1, 0.01); 11dtime = hslider("delay", 0.040, 0, 5, 0.001); 12feedback = hslider("feedback", 0, 0, 1, 0.001); 13stereo = hslider("stereo", 1, 0, 1, 0.001); 14 15/* The stereo parameter controls the amount of stereo spread. For stereo=0 you 16 get a plain delay, without crosstalk between the channels. For stereo=1 you 17 get a pure ping-pong delay where the echos from the left first appear on 18 the right channel and vice versa. Note that you'll hear the stereo effects 19 only if the input signal already has some stereo spread to begin with; if 20 necessary, you can just pan the input signal to the left or the right to 21 achieve that. */ 22 23echo(dtime,level,feedback,stereo,x,y) 24 = f(x,y) // the echo loop 25 // mix 26 : (\(u,v).(x+level*(d(u)+c(v)), 27 y+level*(d(v)+c(u)))) 28 // compensate for gain level 29 : (/(1+level), /(1+level)) 30with { 31 f = g ~ (*(feedback),*(feedback)); 32 g(u,v,x,y) 33 = h(x+d(u)+c(v)), h(y+d(v)+c(u)); 34 h = fdelay(1<<18, SR*dtime); 35 c(x) = x*stereo; 36 d(x) = x*(1-stereo); 37}; 38 39process = vgroup("echo", echo(dtime,level,feedback,stereo)); 40