how can I make a simple lowpass filter with this constraints? I'm searching for a simple low pass filter code in C with this constraints


a modulable frequency cutoff (how can I convert all these crazy coefficients into a frequency?) I could change with a slider.
a dB/Octave I can change in my code.
a resonance I can change in my code.


the graphical result will be a simple slider moving from 0-44Khz.
So far I've only managed to cut a bit of the high ends of my sounds by doing

int i = 0;
while (i &lt; x.size - 1)
{   
    y[i] = (x[i] + x[i+1]) / 2;
    i++;
}


where x is the input buffer (depends of the settings but it goes from 32 to 2048 samples) and y is the output buffer.
check out the music-dsp source code archive here: http://www.musicdsp.org/showmany.php

I recommend a "Chamberlin" State-Variable Filter (which is 12dB/oct) which gives you other flavors (highpass, bandpass, etc) for free. If you cascade two of them you can get 24dB/oct, etc.