[ardour-dev] questions about panner.cc ...
fons adriaensen
fons.adriaensen at skynet.be
Thu Aug 25 10:33:16 PDT 2005
On Thu, Aug 25, 2005 at 11:13:08AM -0400, Paul Davis wrote:
> > I expected to see an attenuation of x in one channel and sqrt(1-x*x) in
> > the other, but I saw:
> >
> > const float pan_law_attenuation = -3.0f;
> > const float scale = 2.0f - 4.0f * powf
> > //snip
> > desired_left = panL * (scale * panL + 1.0f - scale);
> > desired_right = panR * (scale * panR + 1.0f - scale);
> >
> > what is the purpose of this formula?
>
> it provides constant power panning (i.e. the total perceived volume
> during panning remains the same), unlike the more simplistic approach
> you mentioned, which tends to cause a dip or peak in perceived volume
> during parts of a full panning sweep.
x, sqrt (1-x*x) is also constant power, but not symmetrical around
the centre.
> > BTW(not very important), wouldn't be better to replace powf
> > (10.0f,pan_law_attenuation/20.0f) with 1/sqrt(2). and add a comment of
> > //-3db attenuation
>
> could be. DSP has never been my thing, so i'd need someone else confirm
> that this is indeed equivalent.
It is. And both scale and 1-scale could just be replaced by constants.
The scheme used is a (good) approximation to sin(), cos().
--
FA
More information about the Ardour-Dev
mailing list