Search code examples
mathsignal-processingvst

sqrt() VST-Plugin MATH - Loss gain by sqrt()?


is it possible that a calculation with "sqrt()" has affect to the ouput gain? Here's is my Code: (MS Tool with Panorama adjustment)

//Code...precalculations above

(*out1++) = (mid+side) * dGain * sqrt(dOne - dPan); //sqrt for pan law
(*out2++) = (mid-side) * dGain * sqrt(dOne); 

Input/Output Gain is quiet a little different in this case. Any advice?

Thanks


Solution

  • I'm just guessing here, but it seems that your algorithm is attempting to apply stereo panning laws to the left/right channels. In that case, I don't think that the calculation is being done correctly. This link (also posted in a comment) might be useful:

    http://www.kvraudio.com/forum/viewtopic.php?p=4264576

    If my suspicions are correct, then you are not applying the correct amount of gain compensation to the signal, which is why it's probably not sounding as you expect.