Skip to content

Instantly share code, notes, and snippets.

@sletz
Created January 26, 2021 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sletz/74e156ab49ebdb6557f76429cf89ba24 to your computer and use it in GitHub Desktop.
Save sletz/74e156ab49ebdb6557f76429cf89ba24 to your computer and use it in GitHub Desktop.
declare name "freeverb";
declare version "1.0";
declare author "Grame";
declare license "BSD";
declare copyright "(c)GRAME 2006";
//======================================================
//
// Freeverb
// Faster version using fixed delays (20% gain)
//
//======================================================
// Constant Parameters
//--------------------
fixedgain = 0.015; //value of the gain of fxctrl
scalewet = 3.0;
scaledry = 2.0;
scaledamp = 0.4;
scaleroom = 0.28;
offsetroom = 0.7;
initialroom = 0.5;
initialdamp = 0.5;
initialwet = 1.0/scalewet;
initialdry = 0;
initialwidth = 1.0;
initialmode = 0.0;
freezemode = 0.5;
stereospread = 23;
allpassfeed = 0.5; //feedback of the delays used in allpass filters
// Control Sliders
//--------------------
// Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize)
// RoomSize : size of the reverberation room
// Dry : original signal
// Wet : reverberated signal
dampSlider = 0.5 * scaledamp;
roomsizeSlider = 0.9 * scaleroom + offsetroom;
wetSlider = 0.8;
drySlider = 0.2;
combfeed = roomsizeSlider;
// Reverb components
//------------------
monoReverb(fb1, fb2, damp)
= _ <: comb(combtuningL1, fb1, damp),
comb(combtuningL2, fb1, damp),
comb(combtuningL3, fb1, damp),
comb(combtuningL4, fb1, damp),
comb(combtuningL5, fb1, damp),
comb(combtuningL6, fb1, damp),
comb(combtuningL7, fb1, damp),
comb(combtuningL8, fb1, damp)
+>
allpass(allpasstuningL1, fb2)
: allpass(allpasstuningL2, fb2)
: allpass(allpasstuningL3, fb2)
: allpass(allpasstuningL4, fb2)
with {
// Filter Parametres
combtuningL1 = 1116;
combtuningL2 = 1188;
combtuningL3 = 1277;
combtuningL4 = 1356;
combtuningL5 = 1422;
combtuningL6 = 1491;
combtuningL7 = 1557;
combtuningL8 = 1617;
allpasstuningL1 = 556;
allpasstuningL2 = 441;
allpasstuningL3 = 341;
allpasstuningL4 = 225;
// Comb and Allpass filters
//-------------------------
allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_);
comb(dt, fb, damp) = (+ : @(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb));
};
// fxctrl : add an input gain and a wet-dry control to a stereo FX
//----------------------------------------------------------------
fxctrl(g,d,w,Fx) = _ <: (*(g) : Fx : *(w)), *(d) :> _;
// Freeverb
//---------
process = vgroup("Freeverb", fxctrl(fixedgain, drySlider, wetSlider, monoReverb(combfeed, allpassfeed, dampSlider)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment