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