Switching between algorithms

DSP, Plug-in and Host development discussion.
User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Post Thu Feb 15, 2018 8:28 am

Hi guys,
sometimes what looks the easiest can just drive you crazy :lol:

Basically, I'm trying to find a way to remove a loud pop I get when I change between algorithms.
In my processBlock I have something like that, on sample level.

Code: Select all

switch(algoType)
{
  case 0:
     doThis();
     break;

 case 1:
   doThat();
   break;
}
I tried with a fade out (on the block) -> processing -> fadeIn, but it's not helping very much. I also tried a DC block, but without any luck. I want to avoid to have fill another buffer and crossfade between them, becase some algorithms can be a bit heavy on the CPU.

Any hint?

Thanks,
Luca
Audiority
Need a Kontakt scripter? Contact me.

stratum
KVRAF
2114 posts since 29 May, 2012

Re: Switching between algorithms

Post Thu Feb 15, 2018 8:56 am

If fade in/out does not work, it's implemented incorrectly because there is no other way that it could fail.
~stratum~

mystran
KVRAF
5032 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Switching between algorithms

Post Thu Feb 15, 2018 9:05 am

Audiority wrote: I tried with a fade out (on the block) -> processing -> fadeIn, but it's not helping very much. I also tried a DC block, but without any luck. I want to avoid to have fill another buffer and crossfade between them, becase some algorithms can be a bit heavy on the CPU.
There's no magic solution to this problem, sadly.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

joshb
KVRist
85 posts since 13 Apr, 2016

Re: Switching between algorithms

Post Thu Feb 15, 2018 11:18 am

If your algorithms have any filters inside them, you should probably reset their state them before using that algorithm again.

User avatar
syntonica
KVRist
442 posts since 25 Sep, 2014 from Specific Northwest

Re: Switching between algorithms

Post Thu Feb 15, 2018 11:45 am

Fade out/fade in should work. You may still hear an artifact, but it shouldn't pop or click. Play with the timing of each, some waves can do 1ms, but sine waves are really nasty for this and need more time.

Otherwise, crossfade. ;)

User avatar
Max M.
KVRist
275 posts since 20 Apr, 2005 from Moscow, Russian Federation

Re: Switching between algorithms

Post Thu Feb 15, 2018 12:16 pm

I'd say fade-in/fade-out should be at least somewhere around 0.2s (longer->better, personally I'd go for 0.5s) otherwise it's still a click (just softer).

Ivan_C
KVRian
1073 posts since 11 Aug, 2004 from Breuillet, France

Re: Switching between algorithms

Post Fri Feb 16, 2018 1:16 am

When you switch, the new algorithm should be reset. Then, you process both old algorithm and new algorithm at the same time for a given duration (50 ms at least) with fade out for old and fade in for new. Doing so should attenuate enough any pop / click.

Chaotikmind
KVRist
65 posts since 26 Sep, 2005 from France

Re: Switching between algorithms

Post Fri Feb 16, 2018 1:23 am

I personally use a little trick which works depending on the case, i don't fade in/out, i initialize a variable to the value of the last sample and make it decay exponentially, it's mixed with the output.
Very probably won't work for everything but in my specific case it does a good job.

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: Switching between algorithms

Post Sat Feb 17, 2018 4:27 am

Thank you guys!
Audiority
Need a Kontakt scripter? Contact me.

Jimbrowski-one
KVRist
74 posts since 13 Aug, 2007 from Montréal, QC

Re: Switching between algorithms

Post Tue Feb 20, 2018 2:11 pm

Have you considered that the pop/click sound could simply be caused by excessive CPU load? ... Just a stab in the dark.

User avatar
Audiority
KVRian
769 posts since 15 Nov, 2005 from Italy

Re: Switching between algorithms

Post Sat Mar 03, 2018 10:48 am

thanks, but i'm sure it's not that.
Audiority
Need a Kontakt scripter? Contact me.

camsr
KVRAF
6890 posts since 17 Feb, 2005

Re: Switching between algorithms

Post Sun Mar 04, 2018 3:08 pm

It would help to know what the two algorithms in your example are doing. A crossfade should work, by fading to silence and then fading to the new algorithm.
Image

Return to “DSP and Plug-in Development”