Namespace: Sound

Phaser.Types. Sound

Type Definitions


AudioSpriteSound

Audio sprite sound type.

Type:
  • object
Properties:
Name Type Description
spritemap object

Local reference to 'spritemap' object form json file generated by audiosprite tool.

Since: 3.0.0
Source: src/sound/typedefs/AudioSpriteSound.js (Line 1)

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.

Type:
  • object
Properties:
Name Type Description
key string

The string-based key to be used to reference the decoded audio in the audio cache.

data ArrayBuffer | string

The audio data, either a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance.

Since: 3.18.0
Source: src/sound/typedefs/DecodeAudioConfig.js (Line 1)

EachActiveSoundCallback(manager, sound, index, sounds)

Parameters:
Name Type Description
manager Phaser.Sound.BaseSoundManager

The SoundManager

sound Phaser.Sound.BaseSound

The current active Sound

index number

The index of the current active Sound

sounds Array.<Phaser.Sound.BaseSound>

All sounds

Since: 3.0.0
Source: src/sound/typedefs/EachActiveSoundCallback.js (Line 1)

SoundConfig

Config object containing various sound settings.

Type:
  • object
Properties:
Name Type Argument Default Description
mute boolean <optional>
false

Boolean indicating whether the sound should be muted or not.

volume number <optional>
1

A value between 0 (silence) and 1 (full volume).

rate number <optional>
1

Defines the speed at which the sound should be played.

detune number <optional>
0

Represents detuning of sound in cents.

seek number <optional>
0

Position of playback for this sound, in seconds.

loop boolean <optional>
false

Whether or not the sound or current sound marker should loop.

delay number <optional>
0

Time, in seconds, that should elapse before the sound actually starts its playback.

pan number <optional>
0

A value between -1 (full left pan) and 1 (full right pan). 0 means no pan.

Since: 3.0.0
Source: src/sound/typedefs/SoundConfig.js (Line 1)

SoundMarker

Marked section of a sound represented by name, and optionally start time, duration, and config object.

Type:
  • object
Properties:
Name Type Argument Default Description
name string

Unique identifier of a sound marker.

start number <optional>
0

Sound position offset at witch playback should start.

duration number <optional>

Playback duration of this marker.

config Phaser.Types.Sound.SoundConfig <optional>

An optional config object containing default marker settings.

Since: 3.0.0
Source: src/sound/typedefs/SoundMarker.js (Line 1)