audio-and-sound

Implements audio playback, spatial sound, and volume control in Phaser 4 games.

Updated Sep 20, 2026
One-click install
npx skills add https://github.com/AmirOssanloo/helix-game --skill audio-and-sound-amirossanloo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: audio-and-sound
Source: https://github.com/AmirOssanloo/helix-game/tree/main/.claude/skills/audio-and-sound
Command: npx skills add https://github.com/AmirOssanloo/helix-game --skill audio-and-sound-amirossanloo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding sound to a Phaser 4 game involves navigating WebAudio versus HTML5 Audio backends, browser autoplay policies, looping music, audio sprites, and spatial positioning, all of which have subtle gotchas that cause silent failures. ## Core Features & Use Cases - Sound Playback Patterns: Covers fire-and-forget playback via this.sound.play() and retained references via this.sound.add() for ongoing control of volume, rate, detune, seek, loop, and pan. - Audio Sprites and Markers: Explains loading audio sprites with JSON spritemaps and adding manual markers to split long tracks into named segments. - Spatial Audio and Music: Documents WebAudio-only spatial audio with PannerNode, listener positioning, background music looping, and autoplay-policy unlocking. - Use Case: When building a game scene that needs looping background music, positional enemy roars that follow sprites, and cross-browser format fallbacks, this Skill provides the exact API calls and configuration. ## Quick Start Add looping background music and a positional sound effect to my Phaser scene using the audio-and-sound skill.

Frequently Asked Questions about audio-and-sound

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I play sounds and music in a Phaser game?▼

Load audio in preload() with this.load.audio(), then call this.sound.play('key') for fire-and-forget effects or this.sound.add('key', { loop: true }) followed by play() for music you need to control later.

How to loop background music in Phaser 4?▼

Create the sound with this.sound.add('theme', { loop: true, volume: 0.4 }) and call play(). The manager's pauseOnBlur automatically pauses it when the tab loses focus, and you must stop it manually on scene shutdown.

Does Phaser support spatial audio and stereo panning?▼

Spatial audio via PannerNode and stereo panning via StereoPannerNode work only with the WebAudio backend. On HTML5 Audio, pan fires events but has no audible effect, and the source config is silently ignored.

Why is my Phaser audio not playing on mobile browsers?▼

Browsers block audio until user interaction, so the AudioContext starts suspended. Phaser auto-unlocks on touch or key input; check this.sound.locked and wait for the 'unlocked' event before playing.

What audio formats should I use for cross-browser Phaser games?▼

No single format works everywhere, so pass an array like ['assets/bgm.ogg', 'assets/bgm.mp3'] to this.load.audio(). MP3 has the broadest support, while OGG Vorbis lacks Safari support.

How do I play multiple sounds simultaneously with HTML5 Audio?▼

HTML5 Audio uses a pool of audio tags, so specify instances at load time: this.load.audio('shot', 'assets/shot.mp3', { instances: 4 }). WebAudio has no such limitation and is the preferred backend.