Login / Register 0 items | $0.00 New @ KVR
User avatar
Audiority
KVRian
 
724 posts since 15 Nov, 2005, from Italy

Postby Audiority; Thu Feb 15, 2018 8:28 am Switching between algorithms

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
Progsounds | Audiority | Epic SoundLab
Need a Kontakt scripter? Contact me.
stratum
KVRAF
 
1845 posts since 29 May, 2012

Postby stratum; Thu Feb 15, 2018 8:56 am Re: Switching between algorithms

If fade in/out does not work, it's implemented incorrectly because there is no other way that it could fail.
~stratum~
mystran
KVRAF
 
4979 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Thu Feb 15, 2018 9:05 am Re: Switching between algorithms

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.
Image <- plugins | forum
joshb
KVRist
 
77 posts since 13 Apr, 2016

Postby joshb; Thu Feb 15, 2018 11:18 am Re: Switching between algorithms

If your algorithms have any filters inside them, you should probably reset their state them before using that algorithm again.
User avatar
syntonica
KVRist
 
424 posts since 24 Sep, 2014, from Specific Northwest

Postby syntonica; Thu Feb 15, 2018 11:45 am Re: Switching between algorithms

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
 
253 posts since 20 Apr, 2005, from Moscow, Russian Federation

Postby Max M.; Thu Feb 15, 2018 12:16 pm Re: Switching between algorithms

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
 
1062 posts since 11 Aug, 2004, from Marcoussis, France

Postby Ivan_C; Fri Feb 16, 2018 1:16 am Re: Switching between algorithms

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

Postby Chaotikmind; Fri Feb 16, 2018 1:23 am Re: Switching between algorithms

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
 
724 posts since 15 Nov, 2005, from Italy

Postby Audiority; Sat Feb 17, 2018 4:27 am Re: Switching between algorithms

Thank you guys!
Progsounds | Audiority | Epic SoundLab
Need a Kontakt scripter? Contact me.
Jimbrowski-one
KVRist
 
74 posts since 13 Aug, 2007, from Montréal, QC

Postby Jimbrowski-one; Tue Feb 20, 2018 2:11 pm Re: Switching between algorithms

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
 
724 posts since 15 Nov, 2005, from Italy

Postby Audiority; Sat Mar 03, 2018 10:48 am Re: Switching between algorithms

thanks, but i'm sure it's not that.
Progsounds | Audiority | Epic SoundLab
Need a Kontakt scripter? Contact me.
camsr
KVRAF
 
6857 posts since 16 Feb, 2005

Postby camsr; Sun Mar 04, 2018 3:08 pm Re: Switching between algorithms

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

Moderator: KVR Moderators (Main)

Return to DSP and Plug-in Development