audio-and-sound

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

2|10|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/kodingvibes/gamejam-2026 --skill audio-and-sound-kodingvibes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: audio-and-sound
Source: https://github.com/kodingvibes/gamejam-2026/tree/main/participantes/jpyunism/.agents/skills/audio-and-sound
Command: npx skills add https://github.com/kodingvibes/gamejam-2026 --skill audio-and-sound-kodingvibes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding sound to a Phaser game involves many moving parts: loading audio assets, choosing between WebAudio and HTML5 Audio backends, handling browser autoplay policies, controlling volume and looping, and positioning sounds in 2D space. This Skill provides the complete operational knowledge to implement all of these correctly without digging through Phaser source code. ## Core Features & Use Cases - Sound Playback Patterns: Covers fire-and-forget playback with this.sound.play() versus retained references via this.sound.add() for ongoing control of music and effects. - Audio Sprites and Markers: Explains loading audio sprites with JSON configs and adding manual markers to split long tracks into named segments. - Spatial Audio: Details WebAudio-only positional sound using PannerNode, listener positioning, and auto-tracking Game Objects. - Use Case: You are building a platformer and need looping background music, coin pickup sound effects with volume control, and enemy roars that pan based on screen position. This Skill gives you the exact API calls, config options, and gotchas (like iOS pan limitations) to ship it. ## Quick Start Ask the AI to add looping background music and a jump sound effect to your Phaser scene using this 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 a sound in Phaser?▼

Load the audio in preload() with this.load.audio('key', 'file.mp3'), then call this.sound.play('key') in create() for fire-and-forget playback. For ongoing control, use this.sound.add('key') to get a sound instance you can pause, stop, or adjust.

How to loop background music in a Phaser game?▼

Create the sound with a loop config: this.sound.add('music', { loop: true, volume: 0.4 }), then call play() on it. Looping sounds persist across scene changes, so stop them manually on scene shutdown if needed.

Does Phaser support spatial audio or 3D sound positioning?▼

Phaser supports spatial audio only with the WebAudio backend, using a PannerNode configured via the source property in SoundConfig. You set the listener with this.sound.setListenerPosition(x, y) and can auto-track a Game Object with the follow option.

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

Browsers block audio until user interaction, so the AudioContext starts suspended. Phaser unlocks it automatically on the first touch or click; check this.sound.locked and listen for the 'unlocked' event before playing sounds at startup.

What audio formats should I use for Phaser games?▼

No single format works in every browser, so provide an array like ['assets/bgm.ogg', 'assets/bgm.mp3'] and Phaser picks the first supported one. MP3 has the broadest support, while OGG Vorbis does not work on Safari.

What are the limitations of HTML5 Audio in Phaser?▼

HTML5 Audio lacks spatial audio and real stereo panning, has less precise looping, and requires an instances count at load time for simultaneous playback of the same sound. WebAudio is the preferred backend and has none of these limits.