Equal Power Crossfading of Reverb

I was looking at the code in this post and adapted it to what I need. Which is mixing the dry signal and a completely wet reverb and effects chain. But the final post at the end mentions equal power crossfading to avoid a volume drop in the middle of the dial:

After some reading online I think I basically need to do this (I am assuming the signals are de-correlated). I suck at math and just want to know if I am on the right track I sounds like it is working to my ears.

wetMix.setGainLinear(sqrt(fxKnob)); dryMix.setGainLinear(sqrt(1.0-fxKnob));

Am I on the right track? Also, if the signal was correlated would I use a more linear sweep with 0.5 in the middle? What would be an example of a more correlated signal? A chorus? Sorry for all the questions I just want to understand this better so I don’t need to ask about it in the future.

sqrt(0.5) gives you the right -3dB midpoint but, from what I recall trying that, you get nasty steps at the extremities in the signal that is going to towards silence when close to 0 or 1

Something like that using sin() and cos() with ±45° as the limits for the angles.

1 Like

(I know that linked question is about panning, but the principle is the same for crossfading.)

Thanks for the response! That panning math using the sin and cos looks simple enough I may try to implement that. I am not really noticing the issues with the edges of the Square Root pan though so maybe my use case is fine to just use that. I may just code up both and see which one I intuitively like better. I assume the SQRT uses less cycles so if I can get away with that I maybe just keep it.

OK if it works then that’s good. This graph should help illustrate what I mean:

I coded this, does it look pretty much correct? It is sounding fine to me but I want to be sure. In this case the “fxKnob” sweeps from -45 to +45

const double degrad = M_PI / 180; const double sqrt2d2 = sqrt(2)/2.0;

double fxAngle = degrad * fxKnob; // convert degree to rad

wetMix.setGainLinear(sqrt2d2 * (cos(fxAngle) + sin(fxAngle)) );
dryMix.setGainLinear(sqrt2d2 * (cos(fxAngle) - sin(fxAngle)) );

45° is pi/4

So assuming your fxKnob is in the range [-1,1] then just multiply by that for your fxAngle

Yeah I guess I wouldn’t want the "mix"parameter exposed to the user as going from -45 to 45. I switched it to the -1 to +1 system and it sounds great. Thank you

Ah yes sorry, I see now. I missed the bit where you said the fxKnob was ±45!

In Juce 6 you can get a bunch of these crossfading options by using dsp::DryWetMixer and choosing a DryWetMixingRule.

Oh that is interesting, would the equivalent of the above algorithm be the “balanced” rule then? I finished the project I needed this for but I am sure I will have to implement the same thing at some point in the future.