This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

setPosition

Summary

Sets the position of the listener in a 3D cartesian coordinate space. PannerNode objects use this position relative to individual audio sources for spatialization. The x, y, z parameters represent the coordinates in 3D space. The default value is (0,0,0).

Method of apis/webaudio/AudioListenerapis/webaudio/AudioListener

Syntax

var  = AudioListener.setPosition(x, y, z);

Parameters

x

Data-type
Number

y

Data-type
Number

z

Data-type
Number

Return Value

Returns an object of type NumberNumber

Examples

var audioCtx = new AudioContext();
var myListener = audioCtx.listener;
myListener.setPosition(1,1,1);

Related specifications

W3C Web Audio API
W3C Editor’s Draft