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

undefined directions in AudioListener and PannerNode setOrientation()

From: Karl Tomlinson <karlt+public-audio@karlt.net>
Date: Mon, 26 Aug 2013 11:37:12 +1200
To: public-audio@w3.org
Message-ID: <87ob8lxryv.fsf@karlt.net>
Would it make sense to have setOrientation() throw an exception if
any the vectors are zero or otherwise linearly dependent?

It is not possible to determine appropriate panning parameters in
these situations, and the azimuth and elevation from the
calculation in [1] become undefined because an attempt is made to
normalize a zero vector.

If the orientation is not known, then I think it would be better
to retain the previous orientation than to suddenly change to some
default orientation.  Throwing an exception seems the appropriate
way to indicate that a setter method was not successful in
changing anything.

I don't think there is good reason to allow AudioListener's
setOrientation() to succeed in changing only one of the vectors if
the other is zero, nor even in changing both of them when they are
non-zero but linearly dependent.  Having only the up vector would
allow elevation to be calculated, but this is not useful for
panning as it is the right vector that is most important, and both
other independent vectors are required to specify right.

If a source is not directional, then coneInnerAngle is a better
way to specify that than setting the direction to zero, and
coneInnerAngle already defaults to omnidirectional.

[1] https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#Spatialization-panning-algorithm
Received on Sunday, 25 August 2013 23:38:23 UTC

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