Types.Sound
AudioSpriteSound
<static> AudioSpriteSound
Audio sprite sound type.
| name | type | optional | description |
|---|---|---|---|
| spritemap | object | No | Local reference to 'spritemap' object form json file generated by audiosprite tool. |
Type: object
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/AudioSpriteSound.js#L1
Since: 3.0.0
DecodeAudioConfig
<static> DecodeAudioConfig
A Audio Data object.
You can pass an array of these objects to the WebAudioSoundManager decodeAudio method to have it decode
them all at once.
| name | type | optional | description |
|---|---|---|---|
| key | string | No | The string-based key to be used to reference the decoded audio in the audio cache. |
| data | ArrayBuffer | string | No | The audio data, either a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance. |
Type: object
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/DecodeAudioConfig.js#L1
Since: 3.18.0
EachActiveSoundCallback
<static> EachActiveSoundCallback
Type: function
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/EachActiveSoundCallback.js#L1
Since: 3.0.0
SoundConfig
<static> SoundConfig
Config object containing various sound settings.
| name | type | optional | default | description |
|---|---|---|---|---|
| mute | boolean | Yes | false | Boolean indicating whether the sound should be muted or not. |
| volume | number | Yes | 1 | A value between 0 (silence) and 1 (full volume). |
| rate | number | Yes | 1 | Defines the speed at which the sound should be played. |
| detune | number | Yes | 0 | Represents detuning of sound in cents. |
| seek | number | Yes | 0 | Position of playback for this sound, in seconds. |
| loop | boolean | Yes | false | Whether or not the sound or current sound marker should loop. |
| delay | number | Yes | 0 | Time, in seconds, that should elapse before the sound actually starts its playback. |
| pan | number | Yes | 0 | A value between -1 (full left pan) and 1 (full right pan). 0 means no pan. |
| source | Phaser.Types.Sound.SpatialSoundConfig | Yes | null | An optional config object containing default spatial sound settings. |
Type: object
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/SoundConfig.js#L1
Since: 3.0.0
SoundMarker
<static> SoundMarker
Marked section of a sound represented by name, and optionally start time, duration, and config object.
| name | type | optional | default | description |
|---|---|---|---|---|
| name | string | No | Unique identifier of a sound marker. | |
| start | number | Yes | 0 | Sound position offset at witch playback should start. |
| duration | number | Yes | Playback duration of this marker. | |
| config | Phaser.Types.Sound.SoundConfig | Yes | An optional config object containing default marker settings. |
Type: object
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/SoundMarker.js#L1
Since: 3.0.0
SpatialSoundConfig
<static> SpatialSoundConfig
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
| name | type | optional | default | description |
|---|---|---|---|---|
| x | number | Yes | 0 | The horizontal position of the audio in a right-hand Cartesian coordinate system. |
| y | number | Yes | 0 | The vertical position of the audio in a right-hand Cartesian coordinate system. |
| z | number | Yes | 0 | Represents the longitudinal (back and forth) position of the audio in a right-hand Cartesian coordinate system. |
| panningModel | 'equalpower' | 'HRTF' | Yes | "'equalpower'" | An enumerated value determining which spatialization algorithm to use to position the audio in 3D space. |
| distanceModel | 'linear' | 'inverse' | 'exponential' | Yes | "'inverse'" |
| orientationX | number | Yes | 0 | The horizontal position of the audio source's vector in a right-hand Cartesian coordinate system. |
| orientationY | number | Yes | 0 | The vertical position of the audio source's vector in a right-hand Cartesian coordinate system. |
| orientationZ | number | Yes | -1 | Represents the longitudinal (back and forth) position of the audio source's vector in a right-hand Cartesian coordinate system. |
| refDistance | number | Yes | 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 | Yes | 10000 | The maximum distance between the audio source and the listener, after which the volume is not reduced any further. |
| rolloffFactor | number | Yes | 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 | Yes | 360 | The angle, in degrees, of a cone inside of which there will be no volume reduction. |
| coneOuterAngle | number | Yes | 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 | Yes | 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 | Yes | 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
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/SpatialSoundConfig.js#L1
Since: 3.60.0
WebAudioDecodeEntry
<static> WebAudioDecodeEntry
An entry in the Web Audio Decoding Queue.
| name | type | optional | description |
|---|---|---|---|
| key | string | No | The key of the sound. |
| success | function | No | The callback to invoke on successful decoding. |
| failure | function | No | The callback to invoke if the decoding fails. |
| decoding | boolean | No | Has the decoding of this sound file started? |
Type: object
Member of: Phaser.Types.Sound
Source: src/sound/typedefs/WebAudioDecodeEntry.js#L1
Since: 3.60.0