Understanding equal power crossfades I'm trying to implement an equal power crossfade between two uncorrelated signals ($A$ and $B$). From what I understand I need to setup the crossfade in the following way

Come up with a function $f(x)$ that determines the gain applied to a signal where $x$ is from $0$ to $1$. And $0$ represents being all the way faded to signal $A$,and $1$ represents all the way faded to signal $B$.

$f(x)$ should satisfy:
\begin{cases}\begin{align}
f(x)^2 + f(1-x)^2 &amp;= 1\\
f(1) &amp;= 1\\
f(0) &amp;= 0
\end{align}\end{cases}


So I could use the square root cross-fade $f(x) = \sqrt{x}$:


Or I could use the $\cos$ cross-fade $f(x) = \cos\left(\frac{π}{2}x\right)$:




My question is where does this $f(x)^2 + f(1-x)^2 = 1$ restriction come from? I know that we interpret sound pressure on a logarithmic scale but I don't understand why a quadratic relationship is required between two signals to maintain equal perceived volume.
Power of a (real-valued) digital signal $s[n]$ is simply the $s[n]^2$ (or proportional to that, depending if you want to normalize or not).

That's why the constant sum power constraint is $f^2(x) + f^2(1-x) = 1$. That's simply the definition of constant sum of  powers, nothing more.



so, what you've not specified is "logarithmic scale" to what, or what the perceived quantity is.

And the answer is perceived volume is logarithmic to power. The fact that this relation is logarithmic doesn't really matter here – it's only important that to achieve the same perceived volume, you need to have the same power.

Your functions $f$ work on amplitude, and thus, the square comes from the amplitude-to-power relation, not from the power-to-perceived-volume relation.


Ok, this question has become kind of a moving target. I'll try to explain what's up here, in the order my process of thought allows me to explain it:


Perceived volume is a function of signal energy. That is, to get the same perceived volume, you need to produce the same energy.
Power of a signal is proportional to the square of its amplitude, so with $s(t)$ being our signal, $s^2(t) =  \text{const.}$ restraint is very intuitive; energy of that  signal within $\tau$ time units is $\int_{T_0}^{T_0+\tau}s^2(t)\,dt$.
Your signal processing happens on amplitudes; you add amplitudes, not powers. Thus, let $s(t) = a(t) + b(t)$. It follows directly that $s^2(t) = a^2(t) + 2a(t)b(t) + b^2(t)$. Notice the middle $ab$ term!
But the formula we have dictates that $a^2(t) + b^2(t) = 1$. This only makes sense if $\int_{T_0}^{T_0+\tau} 2a(t)b(t)\,dt\equiv 0\quad\forall T_0, \tau$. Which is exactly the case if $a$ and $b$ are uncorrelated. If $a$ and $b$ were correlated, the $ab$ crosscorrelation term could not be equal to 0.