API

Class AbstractSpatialAudioAbstract

Abstract class representing the spatial audio property on a sound or audio bus.

Index
attachedNode: Nullable<Node>

The scene node this spatial audio is currently attached to, or null if not attached.

Which components (position, rotation, or both) of the attached scene node's world transform drive the spatial audio.

coneInnerAngle: number

The spatial cone inner angle, in radians. Defaults to 2π.

  • When the listener is inside the cone inner angle, the volume is at its maximum.
coneOuterAngle: number

The spatial cone outer angle, in radians. Defaults to 2π.

  • When the listener is between the the cone inner and outer angles, the volume fades to its minimum as the listener approaches the outer angle.
  • When the listener is outside the cone outer angle, the volume is at its minimum.
coneOuterVolume: number

The amount of volume reduction outside the coneOuterAngle. Defaults to 0.

distanceModel: "linear" | "inverse" | "exponential"

The algorithm to use to reduce the volume of the audio source as it moves away from the listener. Defaults to "inverse".

Possible values are:

  • "linear": The volume is reduced linearly as the source moves away from the listener.
  • "inverse": The volume is reduced inversely as the source moves away from the listener.
  • "exponential": The volume is reduced exponentially as the source moves away from the listener.
  • spatialMaxDistance
  • spatialMinDistance
  • spatialRolloffFactor
isAttached: boolean

Whether the audio source is attached to a mesh or transform node.

maxDistance: number

The maximum distance between the audio source and the listener, after which the volume is not reduced any further. Defaults to 10000.

  • This value is used only when the distanceModel is set to "linear".
minDistance: number

The distance for reducing volume as the audio source moves away from the listener – i.e. the distance the volume reduction starts at. Defaults to 1.

  • This value is used by all distance models.
minUpdateTime: number

The minimum update time in seconds of the spatialization if it is attached to a mesh or transform node. Defaults to 0.

  • The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.
orientation: Vector3

The spatial orientation used to determine the direction of the audio source. Defaults to (0, 0, -1).

panningEnabled: boolean

Whether to spatially pan the audio source. Defaults to true.

When set to false, the source keeps distance attenuation but does not pan between the left and right channels. Sound cone attenuation is not applied while panning is disabled.

panningModel: "equalpower" | "HRTF"

The spatial panning model. Defaults to "equalpower".

Possible values are:

  • "equalpower": Represents the equal-power panning algorithm, generally regarded as simple and efficient.
  • "HRTF":Renders a stereo output of higher quality than "equalpower" — it uses a convolution with measured impulse responses from human subjects.
position: Vector3

The spatial position. Defaults to (0, 0, 0).

rolloffFactor: number

How quickly the volume is reduced as the source moves away from the listener. Defaults to 1.

  • This value is used by all distance models.
rotation: Vector3

The spatial rotation used to determine the direction of the audio source. Defaults to (0, 0, 0).

rotationQuaternion: Quaternion

The spatial rotation quaternion used to determine the direction of the audio source. Defaults to (0, 0, 0, 1).

useBoundingBox: boolean

Whether the spatial audio is positioned using the attached scene node's bounding box (when the node is a mesh) instead of its world transform.