Geonkick-Synthesizer / geonkick

Geonkick is a free software synthesizer capable of generating a wide range of percussive sounds, including kicks, snares, claps, hi-hats, shakers, and also unique effect sounds.
https://geonkick.org
GNU General Public License v3.0
105 stars 7 forks source link

Filter mute samples (and skip filter) instead of hardclip #57

Closed DerozerDSP closed 7 months ago

DerozerDSP commented 7 months ago

Hi,

its seems that with high input signal, the filter mute sample (and skip filter) instead of hard clip and follow filtering: https://github.com/Geonkick-Synthesizer/geonkick/blob/main/src/dsp/src/filter.c#L231

I don't think this is desidered? Lots of glitch and additional delay with input at higher level?

Thanks for a feedback.

iurienistor commented 7 months ago

If I understood you correctly, yes, for isnan val = 0.0, and for the rest to be hard clipped to +- 1, and for all these case to continue filtering.

iurienistor commented 7 months ago

@DerozerDSP If you want, please, create a pull request.

iurienistor commented 7 months ago

@DerozerDSP actually this will not help, the filter just becomes unstable for some high input and the resonance configuration ... hardcliping will just make the value to stay 1 until the end because the next value depends of the previous... better to be 0.

DerozerDSP commented 7 months ago

@iurienistor not sure I follow you? I can't see any bad on this:

if (std::isnan(input)) {
    input = 0.0f;
}
if (input > 1.0f) {
    input = 1.0f;
}
if (input < -1.0f) {
    input = -1.0f;
}

it clip signal and just continue to process filtering, without delay and glitch towards 0 with high signal. Tried with a high signal as input, seems almost ok? On which settings do you get the filter unstable?

iurienistor commented 7 months ago

@DerozerDSP I tested with the above modifications, and yes, it seems to work better, and makes sense. I'll commit this change. Thank you!

But regarding the unstable issue. Run Geonkick, and don't change any control, enable osc1 filter, and turn the cutoff in the high frequency end... almost until the end. You''ll get this... You can export the sound and see what you'll get. The above modifications will not affect this issue, and I don't know if it can be solved, and I am not an expert on DSPs. image

iurienistor commented 7 months ago

Added the commit: https://github.com/Geonkick-Synthesizer/geonkick/commit/de4c0125772c5a36d55289c72d4abb7fa36e6767

DerozerDSP commented 7 months ago

@iurienistor well, thats due to higher freq set for this kind of filter topology, not the input level.

Its a limit of the Chamberlin version; you can read more about this topic on Nigel page: https://www.earlevel.com/main/2003/03/02/the-digital-state-variable-filter/

It becomes usually unstable for cutoff freq one-sixth of sample rate. How is it configured Geonkick? Can't see any min/max freq bounds for the filter section...

iurienistor commented 7 months ago

@DerozerDSP Thanks for the link. No, it doesn't have a limits. I have tried to run the same sample twice... and it increases the frequency... but also depends of the Q factor. I'll try to revisit the filer, to check if it can be improved.