Make install.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / freeverb.dsp
1 declare name "freeverb";
2 declare version "1.0";
3 declare author "Grame";
4 declare license "BSD";
5 declare copyright "(c)GRAME 2006";
6 declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html";
7
8 //======================================================
9 //
10 // Freeverb
11 // Faster version using fixed delays (20% gain)
12 //
13 //======================================================
14
15
16 // Constant Parameters
17 //--------------------
18
19 fixedgain = 0.015;
20 scalewet = 3.0;
21 scaledry = 2.0;
22 scaledamp = 0.4;
23 scaleroom = 0.28;
24 offsetroom = 0.7;
25 initialroom = 0.5;
26 initialdamp = 0.5;
27 initialwet = 1.0/scalewet;
28 initialdry = 0;
29 initialwidth= 1.0;
30 initialmode = 0.0;
31 freezemode = 0.5;
32 stereospread= 23;
33 allpassfeed = 0.5;
34
35
36 // Filter Parametres
37 //------------------
38
39 combtuningL1 = 1116;
40 combtuningL2 = 1188;
41 combtuningL3 = 1277;
42 combtuningL4 = 1356;
43 combtuningL5 = 1422;
44 combtuningL6 = 1491;
45 combtuningL7 = 1557;
46 combtuningL8 = 1617;
47
48 allpasstuningL1 = 556;
49 allpasstuningL2 = 441;
50 allpasstuningL3 = 341;
51 allpasstuningL4 = 225;
52
53
54 // Control Sliders
55 //--------------------
56 // Damp : filtrage des aigus des echos (surtout actif pour des grandes valeurs de RoomSize)
57 // RoomSize : taille de la piece
58 // Dry : signal original
59 // Wet : signal avec reverbration
60
61 dampSlider = hslider("Damp",0.5, 0, 1, 0.025)*scaledamp;
62 roomsizeSlider = hslider("RoomSize", 0.8, 0, 1, 0.025)*scaleroom + offsetroom;
63 wetSlider = hslider("Wet", 0.8, 0, 1, 0.025);
64 drySlider = hslider("Dry", 0, 0, 1, 0.025);
65 combfeed = roomsizeSlider;
66
67
68
69
70
71 // Comb and Allpass filters
72 //-------------------------
73
74 allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_);
75
76 comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb));
77
78
79 // Reverb components
80 //------------------
81
82 monoReverb(fb1, fb2, damp, spread)
83 = _ <: comb(combtuningL1+spread, fb1, damp),
84 comb(combtuningL2+spread, fb1, damp),
85 comb(combtuningL3+spread, fb1, damp),
86 comb(combtuningL4+spread, fb1, damp),
87 comb(combtuningL5+spread, fb1, damp),
88 comb(combtuningL6+spread, fb1, damp),
89 comb(combtuningL7+spread, fb1, damp),
90 comb(combtuningL8+spread, fb1, damp)
91 +>
92 allpass (allpasstuningL1+spread, fb2)
93 : allpass (allpasstuningL2+spread, fb2)
94 : allpass (allpasstuningL3+spread, fb2)
95 : allpass (allpasstuningL4+spread, fb2)
96 ;
97
98 stereoReverb(fb1, fb2, damp, spread)
99 = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread);
100
101
102 // fxctrl : add an input gain and a wet-dry control to a stereo FX
103 //----------------------------------------------------------------
104
105 fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_;
106
107
108
109 // Freeverb
110 //---------
111
112 freeverb = vgroup("Freeverb", fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)));
113
114 process = freeverb;