DPF to VST data problem ?

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
User avatar
marbangens
Established Member
Posts: 56
Joined: Fri Nov 16, 2018 8:39 pm
Been thanked: 6 times

DPF to VST data problem ?

Post by marbangens »

Hey, sometimes when I create more then 1 vst's in the daw, they crash.
What happens is that I hear a click then the audio on that channel is dead.
The Ui still works and running more then one standalone jack works fine.

what could cause this? :?
I tried google but I don't understand the problem or what to look for
https://github.com/martinbangens/DistoT ... toTVUI.hpp
jpcima
Established Member
Posts: 5
Joined: Tue Aug 13, 2019 6:18 am

Re: DPF to VST data problem ?

Post by jpcima »

It's typical of a dsp which produces NaN values or infinity at some point, and this math error propagates to the output signal and cuts the sound.
User avatar
Michael Willis
Established Member
Posts: 1451
Joined: Mon Oct 03, 2016 3:27 pm
Location: Rocky Mountains, North America
Has thanked: 69 times
Been thanked: 163 times
Contact:

Re: DPF to VST data problem ?

Post by Michael Willis »

Like jpcima says, it might be a problem with NaN or infinite. Look at UNDENORMAL from freeverb3 or SR2_UNDENORMAL from libsamplerate for the countermeasure.

It is also possible that you are using global or static variables, in which case multiple instances of your plugin will contend over the same memory.

Also you need to be very careful with pointers. If you are using pointers and anything goes wrong, it can corrupt memory and cause any manner of bad behavior or crash your plugin and the DAW with it.
User avatar
marbangens
Established Member
Posts: 56
Joined: Fri Nov 16, 2018 8:39 pm
Been thanked: 6 times

Re: DPF to VST data problem ?

Post by marbangens »

Thanks :D gonna look into it :D
User avatar
marbangens
Established Member
Posts: 56
Joined: Fri Nov 16, 2018 8:39 pm
Been thanked: 6 times

Re: DPF to VST data problem ?

Post by marbangens »

Don't get any NuN or Inf from std::fpclassify() like this

Code: Select all

float CheckForBadEggs(double input){
    switch(std::fpclassify(input)) {
        case FP_INFINITE:
	  had_Inf = true;
	  return 0.0;
        case FP_NAN:
	  had_NuN = true;
	  return 0.0;

        default:
	  return 0.0;
   }
}
That code would work for checking that correctly right?
I think it's a pointer problem. Here is a good video I think explains this
https://www.youtube.com/watch?v=iNuTwvD6ciI
jpcima
Established Member
Posts: 5
Joined: Tue Aug 13, 2019 6:18 am

Re: DPF to VST data problem ?

Post by jpcima »

Did you take in account the flag -ffast-math which DPF has as default? maybe try to build in DEBUG=true.

A reason is that, under fast-math optimization, the compiler can consider anormal values as not happening.
It can allow itself to remove isnan() checks, and produce simpler assembly for fpclassify().

You can compare yourself between -O2 -ffast-math, and with only -O2
https://godbolt.org/z/sYcmMP
User avatar
marbangens
Established Member
Posts: 56
Joined: Fri Nov 16, 2018 8:39 pm
Been thanked: 6 times

Re: DPF to VST data problem ?

Post by marbangens »

I got this with DEBUG=true

Code: Select all

had_NuN=1
seems to be from the one vst of 3 that failed
I can't really separate them.
so something like this

Code: Select all

        // Wet knob final blend in
         outFinalL = (sigL1*0.0001*fWet) + sigDryL1 - (sigDryL1*0.0001*fWet);
         outFinalR = (sigR2*0.0001*fWet) + sigDryR2 - (sigDryR2*0.0001*fWet);
would brake the vst? I Haven't seen any problems with the jack stand alone version, why is that different?
wont the host separate them in ram or it has nothing to do with it?
User avatar
marbangens
Established Member
Posts: 56
Joined: Fri Nov 16, 2018 8:39 pm
Been thanked: 6 times

Re: DPF to VST data problem ?

Post by marbangens »

I found the problem :D

Code: Select all

sig = sig * (2*gain);
  
  if (sig < 0.000000001f and sig > -0.000000001f){
   sig = sin(sig);
  }
  sig = sig + sin(0.000000000000000000000000001f);
Don't do that :lol:
but now one of them was created with full volume :lol:
oh man...
Post Reply