Re: Thoughts about the AudioPanner

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
games).

-C

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