PannerNode()
The PannerNode() constructor of the Web Audio API creates a new PannerNode object instance.
Syntax
new PannerNode(context, options);

Parameters
 context  A BaseAudioContext representing the audio context you want the node to be associated with.  
options Optional
  A PannerOptions dictionary object defining the properties you want the PannerNode to have:  
panningModel: The PannerNode.panningModel you want the PannerNode to have (the default is equalpower.) 
distanceModel: The PannerNode.distanceModel you want the PannerNode to have (the default is inverse.) 
positionX: The PannerNode.positionX you want the PannerNode to have (the default is 0.) 
positionY: The PannerNode.positionY you want the PannerNode to have (the default is 0.) 
positionZ: The PannerNode.positionZ you want the PannerNode to have (the default is 0.) 
orientationX: The PannerNode.orientationX you want the PannerNode to have (the default is 1.) 
orientationY: The PannerNode.orientationY you want the PannerNode to have (the default is 0.) 
orientationZ: The PannerNode.orientationZ you want the PannerNode to have (the default is 0.) 
refDistance: The PannerNode.refDistance you want the PannerNode to have. The default is 1, and negative values are not allowed. 
maxDistance: The PannerNode.maxDistance you want the PannerNode to have. The default is 10000, and non-positive values are not allowed. 
rollOffFactor: The PannerNode.rollOffFactor you want the PannerNode to have. The default is 1, and negative values are not allowed. 
coneInnerAngle: The PannerNode.coneInnerAngle you want the PannerNode to have (the default is 360.) 
coneOuterAngle: The PannerNode.coneOuterAngle you want the PannerNode to have (the default is 360.) 
coneOuterGain: The PannerNode.coneOuterGain you want the PannerNode to have. The default is 0, and its value can be in the range 0–1.  channelCount: Represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. (See AudioNode.channelCount for more information.) Its usage and precise definition depend on the value of channelCountMode.   channelCountMode: Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. (See AudioNode.channelCountMode for more information including default values.)   channelInterpretation: Represents an enumerated value describing the meaning of the channels. This interpretation will define how audio up-mixing and down-mixing will happen. The possible values are "speakers" or "discrete". (See AudioNode.channelCountMode for more information including default values.)    
Return value
A new PannerNode object instance.
Exceptions
 
RangeError DOMException
  Thrown if the refDistance, maxDistance, or rolloffFactor properties have been given a value that is outside the accepted range.  
InvalidStateError DOMException
  Thrown if the coneOuterGain property has been given a value outside the accepted range (0–1).  
Examples
var ctx = new AudioContext();

var options = {
  positionX : 1,
  maxDistance: 5000
}

var myPanner = new PannerNode(ctx, options);

Specifications

Specification
Web Audio API # dom-pannernode-pannernode

Browser compatibility




Desktop
Mobile



Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
WebView Android
Chrome Android
Firefox for Android
Opera Android
Safari on IOS
Samsung Internet



PannerNode

55
Before Chrome 59, the default values were not supported.

79
53
No
42
14.1

55
Before version 59, the default values were not supported.


55
Before Chrome 59, the default values were not supported.

53
42
14.5

6.0
Before Samsung Internet 7.0, the default values were not supported.





Found a problem with this page?

Edit on GitHub
Source on GitHub
Report a problem with this content on GitHub
Want to fix the problem yourself? See our Contribution guide.


Last modified: Apr 7, 2022, by MDN contributors


    
{'path': 'public/docs/dom/pannernode/pannernode.html', 'source': 'DevDocs.IO'}