Skip to content
Kitbay
Skill

audio-and-sound

MITUpdated on Aug 21, 202640,693GitHub stars

A reference skill published in the Phaser game framework's own repository for adding sound and music to a Phaser 4 game through its shared sound manager.

What the skill teaches

A reference skill published in the Phaser game framework's own repository for adding sound and music to a Phaser 4 game through its shared sound manager. It explains how Phaser chooses between Web Audio, HTML5 Audio and a silent fallback and what each supports, then covers loading audio with format fallbacks, one-off and retained sounds, volume, rate, detune, looping, seeking and stereo panning, audio sprites and named markers, background music, positional audio that follows a game object, decoding audio at runtime and an analyser for visualisations. Event lists and a source file map follow, and pitfalls cover browser autoplay unlocking, Safari's lack of panning, simultaneous playback limits in HTML5 Audio and looping sounds that outlive a scene.

Capabilities

  • Load and play sounds and music
  • Use audio sprites and markers
  • Add positional audio to game objects
  • Handle browser autoplay unlocking