1 declare name "freeverb";
3 declare author "Grame";
5 declare copyright "(c)GRAME 2006";
6 declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html";
8 //======================================================
11 // Faster version using fixed delays (20% gain)
13 //======================================================
16 // Constant Parameters
17 //--------------------
27 initialwet = 1.0/scalewet;
48 allpasstuningL1 = 556;
49 allpasstuningL2 = 441;
50 allpasstuningL3 = 341;
51 allpasstuningL4 = 225;
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
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;
71 // Comb and Allpass filters
72 //-------------------------
74 allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_);
76 comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb));
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)
92 allpass (allpasstuningL1+spread, fb2)
93 : allpass (allpasstuningL2+spread, fb2)
94 : allpass (allpasstuningL3+spread, fb2)
95 : allpass (allpasstuningL4+spread, fb2)
98 stereoReverb(fb1, fb2, damp, spread)
99 = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread);
102 // fxctrl : add an input gain and a wet-dry control to a stereo FX
103 //----------------------------------------------------------------
105 fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_;
112 freeverb = vgroup("Freeverb", fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)));