1

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.

rob
  • 113
  • 1
  • 7

1 Answers1

3

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.
Marcus Müller
  • 30,525
  • 4
  • 34
  • 58
  • 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? – rob Feb 07 '17 at 18:19
  • 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 :) ) – Marcus Müller Feb 07 '17 at 18:21
  • 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 – rob Feb 07 '17 at 18:26
  • 1
    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 – rob Feb 07 '17 at 18:27
  • I edited the last word in my question to make it more clear – rob Feb 07 '17 at 18:29
  • see my edit, @rob. – Marcus Müller Feb 07 '17 at 18:33
  • @robertbristow-johnson I thought that what was I explained – logarithm isn't what is relevant to the problem, it's the fact that you need to provide constant power (and I must admit that I simply assumed the two signals to be orthogonal without explaining that; I'd much rather see this question marked answered with your answer than mine accepted.). I hence marked the question as duplicate and plan to delete my answer later today (it doesn't add anything) – Marcus Müller Feb 08 '17 at 07:22
  • we have to explain that adding uncorrelated signals adds power and adding correlated signals adds voltage so the power has an extra cross-product term. we have to show why and then show how that translates to crossfade functions. this music-dsp post i did tries to generalize the concept and Olli wrote up something that had similar results. – robert bristow-johnson Feb 08 '17 at 17:56
  • @robertbristow-johnson tried to salvage things. I hope it fits rob's actual question; I kind of feel he revised what he's actually asking. – Marcus Müller Feb 08 '17 at 20:23
  • Marcus, i finally got around to copying my music-dsp answer to this Stack Exchange. but this answer is for the other equal-power crossfade question that appeared earlier. – robert bristow-johnson Jun 21 '18 at 06:21