What's the proper way to pan a stereo signal?
-
- KVRian
- 791 posts since 8 Mar, 2006 from Australia
This is probably been discussed before but couldn't find a mention of it...
What's the proper way to pan a stereo signal?
I understand about panning laws but it seems they only apply to placement of a mono signal within a stereo field.
For stereo signals, would it be more normal to just attenuate the channel being panned away from, or should a percentage of that channel be mixed into the other channel?
From what I've read it seems the normal is to simply attenuate - which I was surprised at because you lose half the signal.
Brad
What's the proper way to pan a stereo signal?
I understand about panning laws but it seems they only apply to placement of a mono signal within a stereo field.
For stereo signals, would it be more normal to just attenuate the channel being panned away from, or should a percentage of that channel be mixed into the other channel?
From what I've read it seems the normal is to simply attenuate - which I was surprised at because you lose half the signal.
Brad
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
you want a so called "constant power pan". i have to look it up to be sure, but as far as remember, the left channel should faded out like the first quarter-period of a cosine as the right channel comes in like the first quarter-period of a sine
-
- KVRian
- Topic Starter
- 791 posts since 8 Mar, 2006 from Australia
Thanks for that. Looked it up, but just to confirm:
LeftOut = cos(pan*pi/2) * LeftIn;
RightOut = sin(pan*pi/2) * RightIn;
where pan is between 0 and 1.
When panned hard to one side you lose the other signal and when centered both channels are partially attenuated?
Brad
LeftOut = cos(pan*pi/2) * LeftIn;
RightOut = sin(pan*pi/2) * RightIn;
where pan is between 0 and 1.
When panned hard to one side you lose the other signal and when centered both channels are partially attenuated?
Brad
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
yes, i think at the center position they are both attenuated by a factor of 1/sqrt(2) - but again, this is just how i remember it.bradr wrote:
When panned hard to one side you lose the other signal and when centered both channels are partially attenuated?
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
ooh, i re-read your question more carefully now. your point is, if the left channel should be partially mixed into the right channel when panning is moved to the right? mmmh, interesting question. i admit, i never thought about that. but to do so, could obviously make sense
-
- KVRian
- 500 posts since 13 Oct, 2004 from Durham, NC USA
No, don't mix L and R; you'll create phase artifacts in lots of material. Admittedly, less than stellar material if it doesn't sum to mono well -- but you want to pan well for both good and bad material.
A constant pan law for stereo assumes uncorrelated sound. If L and R are equal volume and uncorrelated, and you sum them, the resulting level is 3dB louder than A or B. However, I find that lots of stereo signals have high correlation, especially in fundamentals for instrument signals. So a pan law that assumes 3dB increase isn't constant volume. Nor is one that assumes the 6dB increase you get if L=R (i.e., a mono signal).
BTW, with stereo signals it's really called "balance" rather than "pan", not that anyone really cares.
A common way to do it is to simply attenuate the "away" side linearly (from 0 to 100%) as you turn the knob from center. Of course, this isn't a constant volume pan law, but as I mentioned above, a constant volume pan law only really works when the signal is the kind it assumes (uncorrelated).
A constant pan law for stereo assumes uncorrelated sound. If L and R are equal volume and uncorrelated, and you sum them, the resulting level is 3dB louder than A or B. However, I find that lots of stereo signals have high correlation, especially in fundamentals for instrument signals. So a pan law that assumes 3dB increase isn't constant volume. Nor is one that assumes the 6dB increase you get if L=R (i.e., a mono signal).
BTW, with stereo signals it's really called "balance" rather than "pan", not that anyone really cares.
A common way to do it is to simply attenuate the "away" side linearly (from 0 to 100%) as you turn the knob from center. Of course, this isn't a constant volume pan law, but as I mentioned above, a constant volume pan law only really works when the signal is the kind it assumes (uncorrelated).
-
- KVRian
- Topic Starter
- 791 posts since 8 Mar, 2006 from Australia
Thanks heaps, I hadn't thought about the possibility of phase artifacts by mixing left and right, but it makes sense now I think about it.
I think the linear attenuate away might be the best in my case as it means the output of a plugin will be unaltered when centered.
Thanks again
Brad
I think the linear attenuate away might be the best in my case as it means the output of a plugin will be unaltered when centered.
Thanks again
Brad
-
- KVRian
- Topic Starter
- 791 posts since 8 Mar, 2006 from Australia
Hmm. Well I thought I understood panning laws... back to panning mono signals.
Panning laws seem to be defined as -3db, -4.5db or -6db at center and -0db panned hard one way and -oo db the other. But what's the curve in between?
I've seen panning laws qualified at sin/cos taper, sqrt taper etc... but unless I've missed something fundamental, these curves don't go through -3, -4.5 or -6db center points.
eg: a sin/cos taper implemented as:
Centers at 0.707 which is closer to -1.5db, not -3db. How do I implement a -3db sin/cos tapered panning law - which seems to be the most common of these laws?
I've also seen mention of a -6db linear taper panning law, but doesn't a linear taper go through 0.5 at center - or about -3db.
What am I missing?
Panning laws seem to be defined as -3db, -4.5db or -6db at center and -0db panned hard one way and -oo db the other. But what's the curve in between?
I've seen panning laws qualified at sin/cos taper, sqrt taper etc... but unless I've missed something fundamental, these curves don't go through -3, -4.5 or -6db center points.
eg: a sin/cos taper implemented as:
Code: Select all
LeftOut = cos(pan*pi/2) * MonoIn;
RightOut = sin(pan*pi/2) * MonoIn;I've also seen mention of a -6db linear taper panning law, but doesn't a linear taper go through 0.5 at center - or about -3db.
What am I missing?
-
- KVRAF
- 8389 posts since 11 Apr, 2003 from back on the hillside again - but now with a garden!
-
- KVRian
- Topic Starter
- 791 posts since 8 Mar, 2006 from Australia
Ah OK, I was using the wrong definition of dB. Was using 10^(-1.5/10)=0.707.... dB does my head in with its various definitions.
Still doesn't explain how the other panning laws are implemented. eg: what about -4.5db, -6db centered etc... I still think I'm missing something.
Brad
Still doesn't explain how the other panning laws are implemented. eg: what about -4.5db, -6db centered etc... I still think I'm missing something.
Brad
-
- KVRAF
- 1981 posts since 29 Feb, 2004
-4.5dB should be 10^(-4.5/20)=0.595662144
-6dB should be 10^(-6/20)=0.501187234
I have been using 0dB linear taper in Delphi:
fPan = 0 leaves Buf[L] and Buf[R] unchanged...
-6dB should be 10^(-6/20)=0.501187234
I have been using 0dB linear taper in Delphi:
Code: Select all
if fPan > 0 then begin
Buf[L] := Buf[L]*(1-fPan);
Buf[R] := Buf[R] + Buf[L]*(fPan);
end
else if fPan < 0 then begin
Buf[L] := Buf[L] + Buf[R]*(-fPan);
Buf[R] := Buf[R]*(1+fPan);
end;
Last edited by asseca on Sun Sep 03, 2006 5:14 am, edited 1 time in total.
-
- KVRian
- Topic Starter
- 791 posts since 8 Mar, 2006 from Australia
Thanks everyone for your help on this. I think its starting to come together. This is what I have so far, but haven't actually tested any.
Where pan is between 0 (left) and 1 (right):
Mono
-3dB at center, sin/cos taper
-3db at center, sqrt taper
-6db at center, linear taper
-4.5db at center, unknown taper
Stereo
0db at center, linear stereo balance control
0db at center, linear stereo pan (for want of a better name)
This one mixes channel being panned away from into the other channel. eg: When panned hard left, LeftOut=LeftIn+RightIn and vice versa. I think this is the same as asseca's Delphi one.
So its just the -4.5dB one I have no answer for. Anyone?
Brad
Where pan is between 0 (left) and 1 (right):
Mono
-3dB at center, sin/cos taper
Code: Select all
LeftOut = cos(pan*pi/2) * MonoIn;
RightOut = sin(pan*pi/2) * MonoIn;Code: Select all
LeftOut = sqrt(pan) * MonoIn;
RightOut = sqrt(1-pan) * MonoIn;Code: Select all
LeftOut = pan * MonoIn;
RightOut = (1-pan) * MonoIn;Code: Select all
-- don't know --Stereo
0db at center, linear stereo balance control
Code: Select all
if pan<0.5
LeftOut = LeftIn
RightOut = pan * 2 * RightIn
else
LeftOut = (1-pan) * 2 * LeftIn
RightOut = RightIn
end ifThis one mixes channel being panned away from into the other channel. eg: When panned hard left, LeftOut=LeftIn+RightIn and vice versa. I think this is the same as asseca's Delphi one.
Code: Select all
if pan<0.5
LeftOut = LeftIn + (0.5-pan) * 2 * RightIn
RightOut = pan * 2 * RightIn
else
LeftOut = (1-pan) * 2 * LeftIn
RightOut = RightIn + (pan-0.5) * 2 * LeftIn
end ifBrad
-
- KVRAF
- 1981 posts since 29 Feb, 2004
forgot to mention "fpan" range -1 .. 0 .. +1asseca wrote:-4.5dB should be 10^(-4.5/20)=0.595662144
-6dB should be 10^(-6/20)=0.501187234
I have been using 0dB linear taper in Delphi:fPan = 0 leaves Buf[L] and Buf[R] unchanged...Code: Select all
if fPan > 0 then begin Buf[L] := Buf[L]*(1-fPan); Buf[R] := Buf[R] + Buf[L]*(fPan); end else if fPan < 0 then begin Buf[L] := Buf[L] + Buf[R]*(-fPan); Buf[R] := Buf[R]*(1+fPan); end;
-1 = 100% Left
0 = center, no calculations needed for center
+1 = 100% right
Last edited by asseca on Sun Sep 03, 2006 5:15 am, edited 1 time in total.
-
- KVRAF
- 1981 posts since 29 Feb, 2004
These formulas with code seem to be theoretically correct:
pan: 0=left, 0.5=center, 1=right
Mono Pan
0dB (linear)
-1.5dB = 10^(-1.5/20) = 0.841395142 (power taper)
-3dB = 10^(-3/20) = 0.707945784 (equal power taper)
-4.5dB = 10^(-4.5/20) = 0.595662144 (power taper)
-6dB = 10^(-6/20) = 0.501187234 (linear)
pan: 0=left, 0.5=center, 1=right
Mono Pan
0dB (linear)
Code: Select all
if pan = 0.5 then {
LeftOut = MonoIn;
RightOut = MonoIn;
}
else if pan < 0.5 then {
LeftOut = MonoIn;
RightOut = (2*pan) * MonoIn;
}
else if pan > 0.5 then {
LeftOut = 2*(1-pan) * MonoIn;
RightOut = MonoIn;
}-1.5dB = 10^(-1.5/20) = 0.841395142 (power taper)
Code: Select all
LeftOut = power((1-pan),0.25) * MonoIn;
RightOut = power(pan,0.25) * MonoIn;Code: Select all
LeftOut = sqrt(1-pan) * MonoIn; // = power((1-pan),0.5) * MonoIn;
RightOut = sqrt(pan) * MonoIn; // = power(pan,0.5) * MonoInCode: Select all
LeftOut = power((1-pan),0.75) * MonoIn;
RightOut = power(pan,0.75) * MonoIn;Code: Select all
LeftOut = (1-pan) * MonoIn // = power((1-pan),1) * MonoIn;
RightOut = pan * MonoIn // = power(pan,1) * MonoIn;
