PannerNode()
The PannerNode() constructor of the Web Audio API creates a new PannerNode object instance.
Syntax
var myPanner = new PannerNode(context, options);
Parameters
- context
-
A
BaseAudioContextrepresenting the audio context you want the node to be associated with. - options Optional
-
A
PannerOptionsdictionary object defining the properties you want thePannerNodeto have:-
panningModel: ThePannerNode.panningModelyou want thePannerNodeto have (the default isequalpower.) -
distanceModel: ThePannerNode.distanceModelyou want thePannerNodeto have (the default isinverse.) -
positionX: ThePannerNode.positionXyou want thePannerNodeto have (the default is0.) -
positionY: ThePannerNode.positionYyou want thePannerNodeto have (the default is0.) -
positionZ: ThePannerNode.positionZyou want thePannerNodeto have (the default is0.) -
orientationX: ThePannerNode.orientationXyou want thePannerNodeto have (the default is1.) -
orientationY: ThePannerNode.orientationYyou want thePannerNodeto have (the default is0.) -
orientationZ: ThePannerNode.orientationZyou want thePannerNodeto have (the default is0.) -
refDistance: ThePannerNode.refDistanceyou want thePannerNodeto have. The default is1, and negative values are not allowed. -
maxDistance: ThePannerNode.maxDistanceyou want thePannerNodeto have. The default is10000, and non-positive values are not allowed. -
rollOffFactor: ThePannerNode.rollOffFactoryou want thePannerNodeto have. The default is1, and negative values are not allowed. -
coneInnerAngle: ThePannerNode.coneInnerAngleyou want thePannerNodeto have (the default is360.) -
coneOuterAngle: ThePannerNode.coneOuterAngleyou want thePannerNodeto have (the default is360.) -
coneOuterGain: ThePannerNode.coneOuterGainyou want thePannerNodeto have. The default is0, 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. (SeeAudioNode.channelCountfor more information.) Its usage and precise definition depend on the value ofchannelCountMode. -
channelCountMode: Represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. (SeeAudioNode.channelCountModefor 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". (SeeAudioNode.channelCountModefor more information including default values.)
-
Return value
A new PannerNode object instance.
Exceptions
-
RangeErrorDOMException -
Thrown if the
refDistance,maxDistance, orrolloffFactorproperties have been given a value that is outside the accepted range. -
InvalidStateErrorDOMException -
Thrown if the
coneOuterGainproperty has been given a value outside the accepted range (0–1).
Example
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.
|
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/PannerNode