So I dived into plugin development and im having an issue with my filter. I'm developing a simple clip distortion with a pre-distortion filter. For some reason the filter in high-pass or bandpass mode does not seem to cut off correctly when i change the cutoff slope. It only seems to work in low pass mode. In the other two modes, regardless if I change the slope, it seems to cutoff at the same rate, OR it gives me the opposite effect, ie what should be a 12db slope seems to cutoff more than 12db, and if i change it to 24db, more low end is present in high-pass mode
Code: Select all
//slope is an int, everything else is double
double Filter::process(double inputValue) {
if (inputValue == 0.0) return inputValue;
buf0 += cutoff * (inputValue - buf0 + feedbackAmount * (buf0 - buf1));
buf1 += cutoff * (buf0 - buf1);
buf2 += cutoff * (buf1 - buf2);
buf3 += cutoff * (buf2 - buf3);
switch (mode) {
case FILTER_MODE_LOWPASS:
if (slope) { return buf3; }
return buf1;
case FILTER_MODE_HIGHPASS:
if (slope) { return inputValue - buf3; }
return inputValue - buf1;
case FILTER_MODE_BANDPASS:
if (slope) { return buf0 - buf3; }
return buf0 - buf1;
default:
return 0.0;
}
}
Any suggestions or possible alternate filters i could try out?
Also, while I'm here, do you guys have any recommendations for learning more DSP code or something? I'm REALLY new at this (been like 2 weeks) and would like to learn as much as possible.