0
$\begingroup$

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 &= 1\\ f(1) &= 1\\ f(0) &= 0 \end{align}\end{cases}

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.

$\endgroup$
  • 1
    $\begingroup$ it's because when signals are perfectly correlated, an equal-voltage crossfade $$ f(x) + f(1-x) = 1 $$ is what you are looking for. but when there is zero correlation (not a negative correlation), the equal-power crossfade $$f^2(x) + f^2(1-x) = 1$$ is what you want. $\endgroup$ – robert bristow-johnson Feb 7 '17 at 23:32
  • 3
    $\begingroup$ Possible duplicate of Equal power crossfade $\endgroup$ – Marcus Müller Feb 8 '17 at 7:22
  • $\begingroup$ @MarcusMüller I was aware of that post before posting this questions and it is the reason I asked this questions. It does not explain why x^(1/2) should be used for uncorrelated signals $\endgroup$ – rob Feb 8 '17 at 15:09
  • $\begingroup$ Ah! Now we have a new, even more precise question! Please edit your question, unaccept my answer. $\endgroup$ – Marcus Müller Feb 8 '17 at 16:19
  • $\begingroup$ @rob amended my answer. Could you comment on it? $\endgroup$ – Marcus Müller Feb 8 '17 at 20:23
1
$\begingroup$

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:

  1. Perceived volume is a function of signal energy. That is, to get the same perceived volume, you need to produce the same energy.
  2. 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$.
  3. 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!
  4. 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.
$\endgroup$
  • $\begingroup$ But equal power cross fades are defined for a reason. They don't have an audible dip in volume when fading between two signals. Why is that? $\endgroup$ – rob Feb 7 '17 at 18:19
  • $\begingroup$ Because the perceived volume is roughly proportional to power. The reason for that is physics / anatomy / psychoacoustics. (also, your original question was "I don't understand why a quadratic relationship is required between two signals to maintain equal power."; the question you're asking in this comment is "why does constant power mean constant perceived volume", and that's a different one and should probably asked separately instead of in a comment :) ) $\endgroup$ – Marcus Müller Feb 7 '17 at 18:21
  • $\begingroup$ that's what I'm trying to understand. I thought the ear responded to pressure on a logarithmic scale so it is confusing to me that power would be proportional to perceived volume as it is not logarithmic. I would have though that the perceived volume of two combined signals would be their sum in dBs $\endgroup$ – rob Feb 7 '17 at 18:26
  • 1
    $\begingroup$ My questions is "where does this f(x)2+f(1−x)2=1 restriction come from". And it comes from the relationship between perceived volume and power $\endgroup$ – rob Feb 7 '17 at 18:27
  • $\begingroup$ I edited the last word in my question to make it more clear $\endgroup$ – rob Feb 7 '17 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.