Class PannerNode
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The PannerNode interface defines an audio-processing object that represents the location, direction, and behavior of an audio source signal in a simulated physical space. This AudioNode uses right-hand Cartesian coordinates to describe the source's position as a vector and its orientation as a 3D directional cone.
[Value("PannerNode")]
public class PannerNode : AudioNode
- Inheritance
-
PannerNode
- Inherited Members
Remarks
A PannerNode always has exactly one input and one output: the input can be mono or stereo but the output is always stereo (2 channels); you can't have panning effects without at least two audio channels!
The PannerNode defines a spatial position and direction for a given signal.
Constructors
PannerNode()
public PannerNode()
PannerNode(BaseAudioContext, PannerOptions)
The PannerNode() constructor of the Web Audio API creates a new PannerNode object instance.
public PannerNode(BaseAudioContext context, PannerOptions options = null)
Parameters
contextBaseAudioContextoptionsPannerOptions
Remarks
Properties
ConeInnerAngle
The coneInnerAngle property of the PannerNode interface is a double value describing the angle, in degrees, of a cone inside of which there will be no volume reduction.
[Value("coneInnerAngle")]
public Number ConeInnerAngle { get; set; }
Property Value
- Number
A double.
Remarks
The coneInnerAngle property's default value is 360, suitable for a non-directional source.
ConeOuterAngle
The coneOuterAngle property of the PannerNode interface is a double value describing the angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the ConeOuterGain property.
[Value("coneOuterAngle")]
public Number ConeOuterAngle { get; set; }
Property Value
- Number
A double.
Remarks
The coneOuterAngle property's default value is 0.
ConeOuterGain
The coneOuterGain property of the PannerNode interface is a double value, describing the amount of volume reduction outside the cone, defined by the ConeOuterAngle attribute.
[Value("coneOuterGain")]
public Number ConeOuterGain { get; set; }
Property Value
- Number
A double. The default is
0, and its value can be in the range 0–1.
Remarks
The coneOuterGain property's default value is 0, meaning that no sound can be heard outside the cone.
DistanceModel
The distanceModel property of the PannerNode interface is an enumerated value determining which algorithm to use to reduce the volume of the audio source as it moves away from the listener.
[Value("distanceModel")]
public DistanceModelType DistanceModel { get; set; }
Property Value
- DistanceModelType
An enum — see
DistanceModelType.
Remarks
The possible values are:
inverse is the default value of distanceModel.
MaxDistance
The maxDistance property of the PannerNode interface is a double value representing the maximum distance between the audio source and the listener, after which the volume is not reduced any further. This value is used only by the linear distance model.
[Value("maxDistance")]
public Number MaxDistance { get; set; }
Property Value
- Number
A double. The default is
10000, and non-positive values are not allowed.
Remarks
OrientationX
The orientationX property of the PannerNode interface indicates the X (horizontal) component of the
direction in which the audio source is facing, in a 3D Cartesian coordinate space.
[Value("orientationX")]
public AudioParam OrientationX { get; }
Property Value
- AudioParam
An AudioParam whose
valueis the X component of the
direction in which the audio source is facing, in 3D Cartesian coordinate space.
Remarks
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
ConeOuterGain), 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
Value property.
-Using the Web Audio API
-Web Audio spatialization basics
-PannerNode
OrientationY
The orientationY property of the PannerNode interface
indicates the Y (vertical) component of the direction the audio source is facing, in 3D Cartesian coordinate space.
[Value("orientationY")]
public AudioParam OrientationY { get; }
Property Value
- AudioParam
An AudioParam whose
valueis the Y component of the
direction the audio source is facing, in 3D Cartesian coordinate space.
Remarks
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
ConeOuterGain), 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
Value property.
-Using the Web Audio API
-Web Audio spatialization basics
-PannerNode
OrientationZ
The orientationZ property of the PannerNode interface
indicates the Z (depth) component of the direction the audio source is facing, in 3D Cartesian coordinate space.
[Value("orientationZ")]
public AudioParam OrientationZ { get; }
Property Value
- AudioParam
An AudioParam whose
valueis the Z component of the
direction the audio source is facing, in 3D Cartesian coordinate space.
Remarks
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
ConeOuterGain), 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
Value property.
-Using the Web Audio API
-Web Audio spatialization basics
-PannerNode
PanningModel
The panningModel property of the PannerNode interface is an enumerated value determining which spatialization algorithm to use to position the audio in 3D space.
[Value("panningModel")]
public PanningModelType PanningModel { get; set; }
Property Value
- PanningModelType
An enum — see
PanningModelType.
Remarks
PositionX
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).
[Value("positionX")]
public AudioParam PositionX { get; }
Property Value
- AudioParam
An AudioParam whose
valueis the X coordinate of the audio
source's position, in 3D Cartesian coordinates. The default value is 0.
Remarks
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
ConeOuterGain), 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
Value property.
-Using the Web Audio API
-Web Audio spatialization basics
-PannerNode
PositionY
The positionY property of the PannerNode interface specifies the Y coordinate of the audio source's position in 3D Cartesian
coordinates, corresponding to the vertical axis (top-bottom). 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).
[Value("positionY")]
public AudioParam PositionY { get; }
Property Value
- AudioParam
An AudioParam whose
valueis the Y coordinate of the audio
source's position, in 3D Cartesian coordinates.
Remarks
Depending on the directionality of the sound (as specified using the attributes
ConeInnerAngle,
ConeOuterAngle, and
ConeOuterGain), 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
Value property.
-Using the Web Audio API
-Web Audio spatialization basics
-PannerNode
PositionZ
The positionZ property of the PannerNode interface specifies the Z coordinate of the audio source's position in 3D Cartesian
coordinates, corresponding to the depth axis (behind-in front of the
listener). 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).
[Value("positionZ")]
public AudioParam PositionZ { get; }
Property Value
- AudioParam
An AudioParam whose
valueis the Z coordinate of the audio
source's position, in 3D Cartesian coordinates.
Remarks
Depending on the directionality of the sound (as specified using the attributes
ConeInnerAngle,
ConeOuterAngle, and
ConeOuterGain), 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
Value property.
-Using the Web Audio API
-Web Audio spatialization basics
-PannerNode
RefDistance
The refDistance property of the PannerNode interface is a double value representing the reference distance for reducing volume as the audio source moves further from the listener – i.e., the distance at which the volume reduction starts taking effect. This value is used by all distance models.
[Value("refDistance")]
public Number RefDistance { get; set; }
Property Value
- Number
A non-negative number. If the value is set to less than 0, a RangeError is thrown.
Remarks
The refDistance property's default value is 1.
RolloffFactor
The rolloffFactor property of the PannerNode interface is a double value describing how quickly the volume is reduced as the source moves away from the listener. This value is used by all distance models. The rolloffFactor property's default value is 1.
[Value("rolloffFactor")]
public Number RolloffFactor { get; set; }
Property Value
- Number
A number whose range depends on the DistanceModel of the panner as follows (negative values are not allowed):
Remarks
Methods
SetOrientation(Number, Number, Number)
IMPORTANT
DeprecatedNOTE
The suggested replacement for this deprecated method is to instead set theorientationX,orientationY, andorientationZattributes directly.
[Value("setOrientation")]
public GlobalObject.Undefined SetOrientation(Number x, Number y, Number z)
Parameters
Returns
Remarks
The setOrientation() method of the PannerNode Interface defines the direction the audio source is playing in.
This can have a big effect if the sound is very directional — controlled by the three cone-related attributes ConeInnerAngle, ConeOuterAngle, and ConeOuterGain. In such a case, a sound pointing away from the listener can be very quiet or even silent.
The three parameters x, y and z are unitless and describe a direction vector in 3D space using the right-hand Cartesian coordinate system. The default value of the direction vector is (1, 0, 0).
SetPosition(Number, Number, Number)
IMPORTANT
DeprecatedNOTE
The suggested replacement for this deprecated method is to instead set thepositionX,positionY, andpositionZattributes directly.
[Value("setPosition")]
public GlobalObject.Undefined SetPosition(Number x, Number y, Number z)
Parameters
Returns
Remarks
The setPosition() method of the PannerNode Interface defines the position of the audio source relative to the listener (represented by an AudioListener object stored in the Listener attribute.) The three parameters x, y and z are unitless and describe the source's position in 3D space using the right-hand Cartesian coordinate system.
The setPosition() method's default value of the position is (0, 0, 0).