[PD] Equal-power crossfade?

Mathieu Bouchard matju at artengine.ca
Mon Feb 6 20:47:08 CET 2012


Le 2012-02-06 à 14:42:00, Frank Barknecht a écrit :
> On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
>> I need a simple equal-power crossfade between two signals. I asked the same
>> question a few years ago, but i just can't remember how to do it...
> This is used in rj's e_pan.pd:
>
> left = cos(p) * signal
> right = sin(p) * signal
>
> where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by 1.5708...)

That's for panning, not for crossfading.

crossfading is similar, but is the other way around :

signal = left * cos(p) + right * sin(p)

But if left=-right (opposite phase) then the crossfade will quickly fade 
out to silence and back in ;

and if left=right, then your power gain will be (cos(p)+sin(p))² = 
cos²(p)+2sin(p)cos(p)+sin²(p) = 1+2sin(p)cos(p) = 1+sin(2p). This goes up 
to double power (amplitude is multiplied by 1,414).

Generally speaking, as long as L and R don't have frequencies in common, 
this works perfectly, but as soon as they do, you have to do proper phase 
addition : the cosines are added separately from the sines : if you know a 
sinusoïd by its amplitude and phase offset, convert to cartesian before 
adding... this will show you how such things add up.

  ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


More information about the Pd-list mailing list