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