Re: cross fade with equal power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
https://lists.linuxaudio.org/listinfo/linux-audio-user




[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux