Skip to content

PannerNode

Hans Lindetorp edited this page Apr 15, 2021 · 1 revision

The PannerNode interface represents the position and behavior of an audio source signal in space. It is an AudioNode audio-processing module describing its position with right-hand Cartesian coordinates, its movement using a velocity vector and its directionality using a directionality cone.

Attributes:

  • coneInnerAngle
  • coneOuterAngle
  • coneOuterGain
  • distanceModel
  • maxDistance
  • orientationX
  • orientationY
  • orientationZ
  • panningModel
  • positionX
  • positionY
  • positionZ
  • refDistance
  • rolloffFactor

To position a sound in 3D-space is not a trivial task. Please refer to the guide at https://developer.mozilla.org/en-US/docs/Web/API/PannerNode for more information about the various properties.

Example

This example plays the looping audio file through the panner node and lets the incoming "relX" and "relY" (see more on ...) to move the sound on the X, Y and Z axis according to the listener (default positioned at coordinate {X:0, Y:0, Z:0}).

<?xml version="1.0" encoding="UTF-8"?>
<Audio version="1.0" timeUnit="ms" interactionArea="#touchArea" gain="-10dB">
  <Chain>
    <AudioBufferSourceNode loop="true" src="loop.mp3" trig="pointer"></AudioBufferSourceNode>

    <PannerNode panningModel="HRTF" rotationZ="-1" coneInnerAngle="0" coneOuterAngle="360" coneOuterGain="1" positionZ="1">
      <positionX follow="relX" map="0 100 -5 5"></positionX>
      <positionY follow="relY" map="100 0 -5 5"></positionY>
      <positionZ follow="relY" map="100 0 -5 5"></positionZ>
    </PannerNode>

  </Chain>
</Audio>

Read more: https://developer.mozilla.org/en-US/docs/Web/API/PannerNode

Clone this wiki locally