### Moog VCF, variation 2

Type : 24db resonant lowpass
References : CSound source code, Stilson/Smith CCRMA paper., Timo Tossavainen (?) version
Notes :
in[x] and out[x] are member variables, init to 0.0 the controls:

fc = cutoff, nearly linear [0,1] -> [0, fs/2]
res = resonance [0, 4] -> [no resonance, self-oscillation]
Code :
Tdouble MoogVCF::run(double input, double fc, double res)
{
double f = fc * 1.16;
double fb = res * (1.0 - 0.15 * f * f);
input -= out4 * fb;
input *= 0.35013 * (f*f)*(f*f);
out1 = input + 0.3 * in1 + (1 - f) * out1; // Pole 1
in1  = input;
out2 = out1 + 0.3 * in2 + (1 - f) * out2;  // Pole 2
in2  = out1;
out3 = out2 + 0.3 * in3 + (1 - f) * out3;  // Pole 3
in3  = out2;
out4 = out3 + 0.3 * in4 + (1 - f) * out4;  // Pole 4
in4  = out3;
return out4;
}

comment : This one works pretty well, thanks !

from : rdupres[AT]hotmail[DOT]com
comment : could somebody explain, what means this input -= out4 * fb; input *= 0.35013 * (f*f)*(f*f); is "input-" and "input *" the name of an variable ?? or is this an Csound specific parameter ?? I want to translate this piece to Assemblercode Robert Dupres

from : johanc[AT]popbandetleif[DOT]cjb[DOT]net
comment : input is name of a variable with type double. input -= out4 * fb; is just a shorter way for writing: input = input - out4 * fb; and the *= operator is works similar: input *= 0.35013 * (f*f)*(f*f); is equal to input = input * 0.35013 * (f*f)*(f*f); / Johan

from : dfl[AT]ccrma[DOT]stanford[DOT]edu
comment : I've found this filter is unstable at low frequencies, namely when changing quickly from high to low frequencies...

from : williamk[AT]wusik[DOT]com
comment : I'm trying to double-sample this filter, like the Variable-State one. But so far no success, any tips? Wk

from : mail[AT]mutagene[DOT]net
comment : What do you mean no success? What happens? Have you tried doing the usual oversampling tricks (sinc/hermite/mix-with-zeros-and-filter), call the moogVCF twice (with fc = fc*0.5) and then filter and decimate afterwards? I'm been trying to find a good waveshaper to put in the feedback path but haven't found a good sounding stable one yet. I had one version of the filter that tracked the envelope of out4 and used it to control the degree to which values below some threshold (say 0.08) would get squashed towards zero. That sounded ok (actually quite good for very high inputs), but wasn't entirely stable and was glitching for low frequencies. Then I tried a *out4 = (1+d)* (*out4)/(1 + d* (*out4)) waveshaper, but that just aliased horribly and made the filter sound mushy and noisy. Plain old polynomial (x = x-x*x*x) saturation sounds dull. There must be something better out there, though... and I'd much prefer not to have to oversample to get it, though I guess that might be unavoidable.

from : seezeIf[AT]gmail[DOT]com
comment : Excuse me but just a basic question from a young developper in line " input -= out4 * fb; " i don't understand when and how "out4" is initialised is it the "out4" return by the previous execution? which initialisation for the first execution?

from : musicdsp[AT][remove this]dsparsons[DOT]co[DOT]uk
comment : all the outs should be initialised to zero, so first time around, nothing is subtracted. However, thereafter, the previous output is multiplied and subtracted from the input. HTH

from : bardiclug[AT]gmail[DOT]com
comment : YAND (Yet Another Newbie Developer) here - This filter sounds good, and with the addition of a 2nd harmonic waveshaper in the feedback loop, it sounds VERY good. I was hoping I could make it into a HP filter through the normal return in-out4 - but that strategy doesn't work for this method. I'm afraid I'm at a loss as to what to try next - anyone have a suggestion? --Coz