PannerNode

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

« Web Audio API

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

The PannerNode interface represents the behavior of a signal in space. It is an AudioNode, that is an audio-processing module describing its position with a right-hand Cartesian coordinates, its movement using a velocity vector and its directionality using a directionality cone. 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).

The PannerNode brings a spatial position and velocity and a directionality for a given signal.

  • Number of inputs 1
  • Number of outputs 1
  • Channel count mode "clamped-max"
  • Channel count 2
  • Channel interpretation "speakers"

Properties

Inherits properties from its parent, AudioNode.

PannerNode.panningModel
Is an enumerated value determining which spatialization algorithm to use to position the audio in 3D space. The possible values are:
  • "equalpower", representing the equal-power panning algorithm, usually considered as simple and efficient;
  • "HRTF", rendering a stereo output and of higher quality than the previous one as it uses a convolution with measured impulse responses from human subjects. It is the default value.
PannerNode.distanceModel
Is an enumerated value determining which algorithm to use to reduce the volume of the audio source as it moves away from the listeners. The possible values are:
  • "linear", a linear distance model calculating the gain induced by the distance according to: 1 - rolloffFactor * (distance - refDistance) / (maxDistance - refDistance).
  • "inverse", an inverse distance model calculating the gain induced by the distance according to: refDistance / (refDistance + rolloffFactor * (distance - refDistance)). This is the default value.
  • "exponential", an exponential distance model calculating hte gain induced by the distance according to: pow(distance / refDistance, -rolloffFactor)
PannerNode.refDistance
Is a double value representing the reference distance for reducing volume as source move further from the listener. This value is used by all distance model. Its default value is 1.
PannerNode.maxDistance
Is a double value representing the maximum distance between the source and the listener, after which the volume is no more reduced. This value is used only by the "linear" distance model. Its default value is 10000.
PannerNode.rolloffFactor
Is a double value describing how quickly the volume is reduced as the source moves away from listener. This value is used by all distance model. Its default value is 1.
PannerNode.coneInnerAngle
Is a double value describing the angle, in degrees, of the cone, inside of which there will be no volume reduction. Its default value is 360, suitable for a non-directional source.
PannerNode.coneOuterAngle
Is a double value describing the angle, in degrees, of the cone, outside of which the volume will be reduce by a constant value, defined by the coneOuterGain attribute. Its default value is 0.
PannerNode.coneOuterGain
Is a double value describing the amount of volume reduction outside of the cone defined by the coneOuterAngle attribute. Its default value is 0, meaning that no sound can be heard.

Methods

Inherits methods from its parent, AudioNode.

PannerNode.setPosition()
Defines the position of the audio source regarding the position of the person listening to the scene, represented by an AudioListener object stored in the AudioContext.listener attribute. The three parameters x, y and z are unitless and describes the vector in the 3D space using the right-hand Cartesian coordinate system. The default value of the position vector is (0, 0, 0).
PannerNode.setOrientation()
Defines the direction of the audio source. This can have a big effect if the sound is very directional (controlled by the three cone-related attributes): in that 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 describes the vector in the 3D space using the right-hand Cartesian coordinate system. The default value of the position vector is (1, 0, 0).
PannerNode.setVelocity()
Defines the velocity vector of the audio source. The velocity relative to the listener's is used do control the pitch change needed to conform with the Doppler effect due to the relative speed. The vector controls both the direction of travel, and its velocity, as the three parameters x, y and z are expressed in meters per second. The default value of the position vector is (0, 0, 0).

Examples

 

Specifications

Specification Status Comment
Web Audio API Working Draft  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes)webkit Activated on Nightly only Not supported Not supported ?
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support Not supported Activated on Nightly only Not supported Not supported ?

See also

  • Using Web Audio

添付ファイル

ファイル サイズ 日時 添付者:
The PannerNode positioning in the space
The PannerNode brings a spatial position and velocity and a directionality for a given signal.
72539 バイト 2013-04-08 04:15:57 teoli

Document Tags and Contributors

Contributors to this page: Sheppy, kscarfone, teoli
最終更新者: kscarfone,