audio-and-sound

Manage audio loading, playback, and global controls in Phaser 4 games.

Updated Jun 21, 2021
One-click install
npx skills add https://github.com/mahirocoko/mahirocoko --skill audio-and-sound-mahirocoko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audio-and-sound
Source: https://github.com/mahirocoko/mahirocoko/tree/main/plugins/phaser/skills/audio-and-sound
Command: npx skills add https://github.com/mahirocoko/mahirocoko --skill audio-and-sound-mahirocoko

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Phaser 4 games often struggle with consistent audio management across scenes and devices. This Skill provides a unified SoundManager that loads, plays, and controls music, sound effects, and spatial audio, simplifying cross-platform audio handling.

Core Features & Use Cases

  • Unified sound system via this.sound to handle loading, playback, volume, panning, looping, and markers for complex audio flows.
  • Supports Web Audio and HTML5 Audio backends with automatic unlock handling for mobile browsers and pause-on-focus behavior.
  • Includes support for spatial audio, audio sprites, and markers to enable rich, interactive sound design in games.

Quick Start

Load audio assets first, then create and play sounds using the SoundManager in your scene.

Frequently Asked Questions about audio-and-sound

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

FAQPage Schema
How do I add background music and sound effects in Phaser 4?

To add background music and sound effects in Phaser 4, load your audio assets first, then use the unified SoundManager via this.sound to handle playback, volume, and looping across game scenes.

Does Phaser 4 handle mobile audio unlocking for Web Audio automatically?

Yes, Phaser 4 handles mobile audio unlocking automatically by managing the Web Audio context and providing an HTML5 Audio fallback to ensure sounds play correctly when mobile browsers require a user interaction.

Can I use spatial audio and audio sprites in Phaser 4 games?

Yes, you can use spatial audio and audio sprites in Phaser 4 games. The SoundManager supports panning, markers, and audio sprites to enable rich interactive sound design across different platforms.

What is the best way to manage audio across multiple Phaser scenes?

The best way to manage audio across multiple Phaser scenes is using a unified SoundManager system. It coordinates global controls, loading, and playback consistently across scenes without needing manual context switching.

Why does my Phaser 4 audio pause when the window loses focus?

Phaser 4 audio pauses when the window loses focus due to the SoundManager's built-in pause-on-focus behavior. This Web Audio feature automatically suspends and resumes audio context to match the browser's visibility state.