Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Audio
/
Web Audio
Phaser 4.1.0
Phaser 4 examples
Web Audio
16
examples
Examples
16
Audio Control: Volume, Mute, Rate, and Detune
Adjust volume, mute status, playback rate, and detune for individual sounds and the global Sound Manager, while syncing sprite animation speed to the audio rate.
Audio Loop Delay
Demonstrates how to layer multiple audio stems by using sound markers and the delay property within the play configuration to synchronize looping tracks.
Audio Marker Pause and Resume
Demonstrates how to play specific audio markers and use the pause and resume methods to control their playback state.
Audio Markers
Define and play specific sections of a single audio file using markers to manage multiple sound effects.
Audio Seeking
Demonstrates how to start audio at a specific timestamp and dynamically update the playback position using the seek property, including synchronizing a sprite's position with audio progress.
Audio Sprites
Demonstrates how to load a single audio file containing multiple sound effects and play specific markers using an audio sprite JSON configuration.
Multiple Instances of the Same Audio File
Demonstrates how to create and manage multiple independent sound instances using a single loaded audio asset.
Play Audio File
Demonstrates how to load and play an audio file using multiple source formats for browser compatibility and how to toggle automatic pausing when the game loses focus.
Play Audio From Child Scene
This example demonstrates how to preload audio in one scene and play it in a subsequent scene, showing that audio assets and the Sound Manager persist across scene transitions.
Play Audio From File Pack
Demonstrates how to load and play audio using a File Pack object, which allows you to define multiple asset types in a single manifest for bulk loading.
Play Movement Sound
Demonstrates how to trigger and manage sound effects based on player movement and interaction, including logic to prevent overlapping audio while walking.
Play Sound on Keypress
Trigger specific audio files using keyboard input listeners and stop all active sounds using the sound manager.
Reuse Web Audio Context
Demonstrates how to provide an externally created Web Audio context to the Phaser game configuration, allowing the audio context to persist across multiple game instances.
Spatial Audio Following a Sprite
This example demonstrates how to set a fixed listener position and have a sound source follow a moving Sprite, automatically updating its spatial panning and volume as the sprite moves.
Spatial Audio Moving with Player
Learn how to update the Web Audio listener position to follow a player sprite, creating a dynamic soundscape as the character moves through a world of localized audio sources.
Web Audio Playback and Events
A comprehensive demonstration of controlling audio playback in Phaser, including play, pause, seek, volume fades, rate and detune adjustments, global sound management, and audio sprites.