Phaser API Documentation

  Version: 

Member of: Phaser.Types.Sound

SpatialSoundConfig

Description:

Config object containing settings for the source of the spatial sound.

See https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Web_audio_spatialization_basics

Properties:
name type arguments Default description
x number <optional> 0

The horizontal position of the audio in a right-hand Cartesian coordinate system.

y number <optional> 0

The vertical position of the audio in a right-hand Cartesian coordinate system.

z number <optional> 0

Represents the longitudinal (back and forth) position of the audio in a right-hand Cartesian coordinate system.

panningModel 'equalpower' | 'HRTF' <optional> 'equalpower'

An enumerated value determining which spatialization algorithm to use to position the audio in 3D space.

distanceModel 'linear' | 'inverse' | 'exponential' <optional> 'inverse'

Which algorithm to use to reduce the volume of the audio source as it moves away from the listener. Possible values are "linear", "inverse" and "exponential". The default value is "inverse".

orientationX number <optional> 0

The horizontal position of the audio source's vector in a right-hand Cartesian coordinate system.

orientationY number <optional> 0

The vertical position of the audio source's vector in a right-hand Cartesian coordinate system.

orientationZ number <optional> -1

Represents the longitudinal (back and forth) position of the audio source's vector in a right-hand Cartesian coordinate system.

refDistance number <optional> 1

A double value representing the reference distance for reducing volume as the audio source moves further from the listener. For distances greater than this the volume will be reduced based on rolloffFactor and distanceModel.

maxDistance number <optional> 10000

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

rolloffFactor number <optional> 1

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.

coneInnerAngle number <optional> 360

The angle, in degrees, of a cone inside of which there will be no volume reduction.

coneOuterAngle number <optional> 0

The angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneOuterGain property.

coneOuterGain number <optional> 0

The amount of volume reduction outside the cone defined by the coneOuterAngle attribute. Its default value is 0, meaning that no sound can be heard. A value between 0 and 1.

follow Phaser.Types.Math.Vector2Like <optional>

Set this Sound object to automatically track the x/y position of this object. Can be a Phaser Game Object, Vec2 or anything that exposes public x/y properties.

Type:
object
Since: 3.60.0