[LAU] cross fade with equal power

Will Godfrey willgodfrey at musically.me.uk
Sat Feb 15 10:25:53 CET 2020


On Sat, 15 Feb 2020 00:59:29 +0100
Robin Gareus <robin at gareus.org> wrote:

>On 2/15/20 12:19 AM, Will Godfrey wrote:
>
>> This is what I use for near constant power panning. Any good?
>> float t = (float)(GlobalPar.PPanning - 1) / 126.0f;
>> pangainL = cosf(t * Pi/2);
>> pangainR = cosf((1.0f - t) * Pi/2);  
>
>Why cosine? You might want to use sinus curve as deflection
>`t = sin(t * M_PI/2)`, but since signal-power is proportional to the
>square of the signal [1], for equal power pan you want square root:
>
>  gainL = sqrtf (t) / DB3
>  gainR = sqrtf (1.f - t) / DB3
>
>where #define DB3 1.4125375 // 10^(3/20)
>
>> Where GlobalPar.PPanning is in the range 0 - 127
>> It actually gives a 3dB hump in the middle  
>
>You should attenuate the signal by 3dB to prevent clipping, or maybe
>only 2.5dB or perhaps 4.5dB, 4.2dB is also not unheard of:
>
>http://admiralbumblebee.com/music/2019/12/08/Daw-V-Daw-Pan-Curves.html
>
>Cheers!
>robin
>
>
>[1] Power is P = U * I
>plug in Ohm's Law: R = U / I
>P = U^2 / R
>_______________________________________________

Most interesting. Thanks for the link. A fascinating read!

I don't actually know where the law I use originally came from, but I'll be
reconsidering.

-- 
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.


More information about the Linux-audio-user mailing list