Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Sound
Phaser.Types.Sound

Type Definitions

AudioSpriteSound
Focus
Focus

Description:

Audio sprite sound type.

Properties:
name type description
spritemap object

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

Type:
object
Since: 3.0.0
Focus
Focus
DecodeAudioConfig
Focus
Focus

Description:

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.

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.

Type:
object
Since: 3.18.0
Focus
Focus
EachActiveSoundCallback(manager, sound, index, sounds)
Focus
Focus

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

Type:
function
Since: 3.0.0
Focus
Focus
SoundConfig
Focus
Focus

Description:

Config object containing various sound settings.

Properties:
name type arguments 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.

Type:
object
Since: 3.0.0
Focus
Focus
SoundMarker
Focus
Focus

Description:

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

Properties:
name type arguments description
name string

Unique identifier of a sound marker.

start number <optional>

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.

Type:
object
Since: 3.0.0
Focus
Focus