Moog-like filter question?

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi, all!

I've tried to make Moog filter from musicdsp -

Code: Select all

Code : 
// Moog 24 dB/oct resonant lowpass VCF
// References: CSound source code, Stilson/Smith CCRMA paper.
// Modified by paul.kellett@maxim.abel.co.uk 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);
LP filter works great, but HP doesn't work like LP. It doesn't attenuate signal when Resonance is raised. How to fix this? :help: Or how to remove attenuation from LP?

I'd like to have identical (frequency-reversed) responces for both filters

Post

kartalex wrote:It doesn't attenuate signal when Resonance is raised. How to fix this? :help: Or how to remove attenuation from LP?
Either:
1) lowpass_out = (1+q)*b4 , or
2) in -= q*(b4 - in)

Same in case that filter is linear (in case of nonlinear filter I like 1) quite a bit more but that's personal preference). BTW in case you didn't notice that, you will get highpass with 6dB/oct slope with substraction trick instead of 24 db/oct. If you want 24 db/oct HP there is more elaborate trick (mixing outputs of first order blocks).

Post

kartalex wrote: Or how to remove attenuation from LP?
You could place a HP filter in the feedback path - then those frequencies won't attenuate(nor will they resonate) - some synth filters do this - you seriously don't want a filter to resonate below about 40/50Hz inanyway IMHO. Real filters also attenuate the same way - you could alway add some make-up gain from where the Resonace setting is. As for pole-mixing - it's explained somehere here on KVR. Based on the Oberheim X-pander - if I remember correctly. Just do a search.

Andrew

Post

urosh wrote:If you want 24 db/oct HP there is more elaborate trick (mixing outputs of first order blocks).
How to do it?

I'm sorry, may be this question is dumb.. But it would be a great lesson for me

Post


Post

Thanks, Ichad.c and Mystran too!

But I didn't understand a word in that thread yet :-)

Is it possible to get the 24 db HP from the algorithm above? I'm not good enough at DSP for understand what are poles and zeros and at the moment I'm trying to build a simple VST filter with LP HP and BP modes. I liked the sound of this example from musicdsp and decided to use the algorithm. But unfortunately HP is not real - just subtraction of LP from the input....

The aim for me is learning the VST and VSTGUI architecture, how the parameters and classes work.. I'm not diving into the abyss of DSP at the moment - I'll do it later :-)

Post Reply

Return to “DSP and Plugin Development”