W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2012

Re: Thoughts about the AudioPanner

From: Chris Wilson <cwilso@google.com>
Date: Thu, 2 Aug 2012 16:14:30 -0700
Message-ID: <CAJK2wqV8OOz0A7vmUymLb2AjYa6OdAcE0_KzQbEXCKLrjTP9OA@mail.gmail.com>
To: Chris Rogers <crogers@google.com>
Cc: Peter van der Noord <peterdunord@gmail.com>, public-audio@w3.org
On Thu, Aug 2, 2012 at 12:10 PM, Chris Rogers <crogers@google.com> wrote:

> Your technique using "newPanningPosition" does *not* actually achieve
> equal-power panning because the distance from the listener is changing, and
> the changing distance changes the attenuation.  In order to get equal-power
> panning you need to move around a circle at an equal distance from the
> listener.  You can see the nitty-gritty details in the spec here:
> https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#Spatialization-section
> I think this code will get you real equal-power panning for more musical
> applications:
> var x = Math.sin(0.5*Math.PI * panPosition);
> var z = -Math.cos(0.5*Math.PI * panPosition);
> panner.panningModel = webkitAudioPannerNode.EQUALPOWER;
> panner.setPosition(x, 0, z);

Actually, there were more things wrong that just that - e.g. that I didn't
set the panningModel to EQUALPOWER.  :)

> The parametric control is via cartesian coordinates which is perfect for
> games and is taken directly from OpenAL.  Other game audio APIs also use
> this approach, so it's well accepted in the industry.  For music, it's not
> as convenient.  To make this more inviting for music, one flexible approach
> would be to expose the "azimuth" (and "elevation") (both of which are
> explained in the specification) as writable AudioParams.  That way the
> panner can be controlled in either way.

I think we had a conversation about that just before I/O, where I asked why
the inputs to AudioPanner weren't AudioParams.  Azimuth and elevation would
certainly be easier to drive for musical apps (though not as easy for

Received on Thursday, 2 August 2012 23:14:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:11 UTC