Hier de versie met detuning:
Code:
declare name "Chaos3";
declare options "[midi:on]";
declare options "[nvoices:12]";
import("maths.lib");
import("reverbs.lib");
import("filters.lib");
import("stdfaust.lib");
//------------------------------
freq = hslider("[1]freq",200,50,5000,0.01);
gate = button("[5]gate");
gain = hslider("[2]gain",0.5,0,1,0.01);
bend = ba.semi2ratio(hslider("bend[midi:pitchwheel]",0,-20,20,0.01)) : si.smoo;
oct = hslider("octave", 1, 1, 2, 0.01);
//------------------------------
//------------------------------
add(x,y) = x,y : +;
block(x,y) = x,y :_*(1-_);
leak(x) = x*(1-le);
C = ((add,_) : (block:leak)) ~ _;
A(x,y) = x,y,y;
AA(x,y) = x,x,y,y;
AAA(x,y) = x,x,y;
//------------------------------
//------------------------------
le = hslider("[3]Leak[scale:log]", 0.00000000001,0.00000000001,1,0.00000000001);
pa = hslider("[4]Parameter", 0.6, 0.55,1,0.001);
timeconstant = 0.151/(bend*(freq*oct)^0.92);
//------------------------------
//----clean version of R -------
B = _ : _/SR : _/timeconstant : _;
Integrator = A : B,_,_ : block,_ : C;
P = _,_,_ : add,_ : A : Integrator,_ : AA : _,Integrator,_ : _,AAA : _,_, Integrator : _,_,_;
Q(x,y,z) = -1*pa*x - y + abs(z) - 1;
R = (P : Q) ~ _;
//------------------------------
//----first detuned version of R-----
det1 = hslider("detune1", 0, 0,0.02,0.00001);
Bd = _ : _/SR : _*(1+det1)/timeconstant : _;
Integratord = A : Bd,_,_ : block,_ : C;
Pd = _,_,_ : add,_ : A : Integratord,_ : AA : _,Integratord,_ : _,AAA : _,_, Integratord : _,_,_;
Q(x,y,z) = -1*pa*x - y + abs(z) - 1;
Rd = (Pd : Q) ~ _;
//------------------------------
//----second detuned version of R-----
det2 = hslider("detune2", 0, 0,0.02,0.00001);
Bdd = _ : _/SR : _*(1+det2)/timeconstant : _;
Integratordd = A : Bdd,_,_ : block,_ : C;
Pdd = _,_,_ : add,_ : A : Integratordd,_ : AA : _,Integratordd,_ : _,AAA : _,_, Integratordd : _,_,_;
Q(x,y,z) = -1*pa*x - y + abs(z) - 1;
Rdd = (Pdd : Q) ~ _;
//------------------------------
//-----envelope-----------------
att = hslider("[6]attack", 0.01, 0, 1, 0.01);
dec = hslider("[7]decay", 0.01, 0, 1, 0.01);
sus = hslider("[8]sustain", 0.8, 0.1, 1, 0.01);
rel = hslider("[9]release", 0.1, 0, 5, 0.01);
envelope = en.adsr(att,dec,sus,rel,gate)*gain;
//------------------------------
//---------reverb---------------
t60 = hslider("reverberation time", 10, 0.1, 60, 0.01);
damp = hslider("damping ", 0.5, 0, 1, 0.01);
size = hslider("size", 3, 0.5, 5, 0.01);
early_diff = hslider("early reflections", 0.5, 0, 1, 0.01);
mod_depth = hslider("modulation depth", 0.1, 0, 1, 0.01);
mod_freq = hslider("modulation frequency", 1, 0, 10, 0.01);
low = hslider("low band", 0.5, 0, 1, 0.01);
mid = hslider("mid band", 0.5, 0, 1, 0.01);
high = hslider("high band", 0.5, 0, 1, 0.01);
low_cutoff = hslider("low cutoff", 500, 100, 6000, 1);
high_cutoff = hslider("high cutoff", 5000, 1000, 10000, 1);
V = jpverb(t60, damp, size, early_diff, mod_depth, mod_freq, low, mid, high, low_cutoff, high_cutoff);
//------------------------------
//------------------------------
vol1 = hslider("volume1", 0.5, 0, 1, 0.01);
vol2 = hslider("volume2", 0.5, 0, 1, 0.01);
vol3 = hslider("volume3", 0.5, 0, 1, 0.01);
//------------------------------
process = (R*vol1 + Rd*vol2 + Rdd*vol3)*0.1 : _*envelope <: V : dcblocker,dcblocker;
