-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VAxx filters' frequency parameter not scaled properly #28
Comments
I can confirm.
At 44.1 kHz, this x3 ratio seems to hold consistently, e.g., if I set the cutoff to 110, then I clearly hear the third harmonic 330 Hz resonating. Work-around-able by writing SynthDefs with |
I agree - this is definately a problem. Also, kind of related: It sounds to me like the filters have too much gain boost even on low settings. I think this should be fixed in the code. If anyone feels like doing a PR that would be amazing - otherwise I will get around to it some rainy day. Thanks! |
This appears to be independent of sample rate btw -- I've tried at 44.1 kHz and 96 kHz, and they both seem to sound the same. |
Thanks. That's a helpful observation. I have a suspicion that the problem might be somewhere around here, but I'm not sure yet. It's only a hunch so far: https://github.com/madskjeldgaard/portedplugins/blob/main/plugins/odinfilters/Korg35Filter.cpp#L51 Particularly the first part - I suspect that the first part should not be 2 * samplerate but 2 / T where T is 1/samplerate. This is what that section looks like in William Pirkle's Designing Synthesizer's book (first edition): double wd = 2*pi*Fc;
double T = 1/SampleRate;
double wa = (2/T)*tan(wd*T/2);
double g = wa*T/2; // <--- i.e. g = tan(wd*T/2)
// --- final calculation
double alpha = g/(1.0 + g); |
A slightly related issue here. I think these filters need a little overhaul #30 |
But, if t = 1/sr, then 2/t == 2 / (1/sr) == 2 * sr. TBH my filter theory isn't that good... would take awhile for me to spot it. |
haha good point - also explains why there was no difference when I messed with this ;) |
One other detail: VALadder and VAKorg35 seem to filter at the given frequency * 3. VADiodeFilter is at given frequency * 2.17. No idea why. |
Comparing to the port of the same filters and code in the Odin project I honestly cannot tell the difference between how we do it and how they do it. https://github.com/surge-synthesizer/surge/blob/main/src/common/dsp/filters/K35Filter.cpp#L66 |
Describe the bug
Cutoff frequency of all the zdf filters is scaled too high
To Reproduce
{ VALadder.ar(Saw.ar(200), 50)}.freqscope
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: