Add sinwave, fft and fft2d examples.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2pd / examples / synth / echo.dsp
1
2 /* Stereo delay with feedback. */
3
4 declare name "echo -- stereo delay effect";
5 declare author "Albert Graef";
6 declare version "1.0";
7
8 import("music.lib");
9
10 level = hslider("level", 1, 0, 1, 0.01);
11 dtime = hslider("delay", 0.040, 0, 5, 0.001);
12 feedback = hslider("feedback", 0, 0, 1, 0.001);
13 stereo = 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
23 echo(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))
30 with {
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
39 process = vgroup("echo", echo(dtime,level,feedback,stereo));