| The issue with the sqrt in panning comes from the fact that loudness is proportional to power. If you remember your circuits from physics, P=V^2/R. A digitized audio signal can be thought of as voltage vs. time, thus to make the signal twice as loud, the voltage must be increased by 4. To make the signal half as loud voltage must be 0.707 its original.
When I do panning, I use trigonometry. Strength of the left channel is multiplied by the cos of an angle, and the strength of the right channel is multiplied by the sin of an angle. The angle varies from 0 degrees (hard left) to 90 degrees (hard right). Since cos^2(x) + sin^2(x) = 1, this provides a constant power pan. Plus, it is very easy to put a sine wave in a table to allow fast processing.
Example:
;kpan varys from 0 (hard left) to 1 (hard right)
;asig is the signal to be panned
;function 100 is a quarter sine wave given by:
;f100 0.0 8193 9 .25 1.0 0.0
kleft table (1 - kpan), 100, 1
kright table kpan, 100, 1
outs kleft*asig, kright*asig
-----Original Message-----
From: John Boyd [SMTP:jboyd@protozoa.com]
Sent: Tuesday, November 04, 1997 7:23 PM
To: csound
Subject: Re: stereo by dodge
pete moss wrote:
> hello all,
> here is a question about making a stereo signal in an orc.
> most of you seem to like doing something like this:
>
> outs asig*ix, asig*(1-ix) ; if ix = 1 then left channel only, if ix
> = 0 then right
>
> on p318 of dodge v2, he recommends doing a similar operation
>
> outs asig*sqrt(ix), asig*sqrt(1-ix)
>
> is one better than the other? if ix = .5, then the signal will be
> between channels. in the first case, the signal will be at half
> intensity, in the second, the signal will be multiplied by .707, which
> is greater than .5. who has the better method, dodge or the rest of
> you? i have been using the former method myself, but maybe dodge is
> better?
Definitely use the dodge example otherwise you'll get what's known as "The
hole in the middle" effect when you pan your sound across the stereo
field. You don't want your sound to seem like it's far away as you
approach the center (unless for some reason you want that). I think that
many hardware mixers do this sqrt type of panning automatically...
If speed is an issue, you might pre-calculate a function table curve to
index the same panning effect. Read about this in Richard Moore's book
(Elements of Computer Music).
john
|