Moog VCF, variation 1¶
- Author or source: CSound source code, Stilson/Smith CCRMA paper., Paul Kellett version
- Type: 24db resonant lowpass
- Created: 2002-01-17 02:03:52
The second "q =" line previously used exp() - I'm not sure if what I've done is any faster, but this line needs playing with anyway as it controls which frequencies will self-oscillate. I think it could be tweaked to sound better than it currently does. Highpass / Bandpass : They are only 6dB/oct, but still seem musically useful - the 'fruity' sound of the 24dB/oct lowpass is retained.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// Moog 24 dB/oct resonant lowpass VCF // References: CSound source code, Stilson/Smith CCRMA paper. // Modified by firstname.lastname@example.org July 2000 float f, p, q; //filter coefficients float b0, b1, b2, b3, b4; //filter buffers (beware denormals!) float t1, t2; //temporary buffers // Set coefficients given frequency & resonance [0.0...1.0] q = 1.0f - frequency; p = frequency + 0.8f * frequency * q; f = p + p - 1.0f; q = resonance * (1.0f + 0.5f * q * (1.0f - q + 5.6f * q * q)); // Filter (in [-1.0...+1.0]) in -= q * b4; //feedback t1 = b1; b1 = (in + b0) * p - b1 * f; t2 = b2; b2 = (b1 + t1) * p - b2 * f; t1 = b3; b3 = (b2 + t2) * p - b3 * f; b4 = (b3 + t1) * p - b4 * f; b4 = b4 - b4 * b4 * b4 * 0.166667f; //clipping b0 = in; // Lowpass output: b4 // Highpass output: in - b4; // Bandpass output: 3.0f * (b3 - b4);