Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).

The positionX property of the PannerNode interface specifies the X coordinate of the audio source's position in 3D Cartesian coordinates, corresponding to the horizontal axis (left-right).

The complete vector is defined by the position of the audio source, given as (positionX, positionY, positionZ), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationX, orientationY, orientationZ).

Depending on the directionality of the sound (as specified using the attributes coneInnerAngle, coneOuterAngle, and codeOuterGain), the orientation of the sound may alter the perceived volume of the sound as it's being played. If the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener.

The AudioParam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its AudioParam.value property.


var positionX = PannerNode.positionX;

PannerNode.positionX.value = newPositionX;


An AudioParam whose value is the X coordinate of the audio source's position, in 3D Cartesian coordinates. The default value is 0.


The following example starts an oscillator, and pans it to the left after 1 second, to the right after 2 seconds, and back to the center after 3 seconds.

const context = new AudioContext();

const osc = new OscillatorNode(context);
const panner = new PannerNode(context);

panner.positionX.setValueAtTime(-1, context.currentTime + 1);
panner.positionX.setValueAtTime(1, context.currentTime + 2);
panner.positionX.setValueAtTime(0, context.currentTime + 3);






Specification Status Comment
Web Audio API
The definition of 'positionX' in that specification.
Working Draft  

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
positionXChrome Full support YesEdge Full support YesFirefox Full support 50IE No support NoOpera Full support YesSafari No support NoWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 50Opera Android Full support YesSafari iOS No support NoSamsung Internet Android Full support Yes


Full support  
Full support
No support  
No support

See also

Etiquetas y colaboradores del documento

Colaboradores en esta página: mdnwebdocs-bot, MzMzEckotimez, jakubfiala, fscholz, Sheppy
Última actualización por: mdnwebdocs-bot,