audio

Adds sound effects, music, and spatial audio to ignifx games via @ignifx/audio.

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/astrum-forge/ignifx --skill audio-astrum-forge
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audio
Source: https://github.com/astrum-forge/ignifx/tree/main/packages/audio/skills/audio
Command: npx skills add https://github.com/astrum-forge/ignifx --skill audio-astrum-forge

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @ignifx/core, @babylonjs/lite.

What problem does it solve? Adding sound to a browser game involves Web Audio unlock gestures, mixer routing, spatial positioning, and music crossfades, all of which are tedious to wire up correctly. This Skill provides the @ignifx/audio extension with a bus tree, AudioSource and AudioListener components, and a MusicPlayer so an ignifx game can play effects and music in browsers, Electron, and headless Node tests. ## Core Features & Use Cases - Mixer bus tree: Named buses (Master, Music, SFX, UI, Voice) with per-bus gain, declared in code or an .audio.json file, with configurable pause behavior. - AudioSource and AudioListener components: Per-entity playback with volume, pitch, looping, instance limits, and 3D spatial audio with distance models and cones. - MusicPlayer with crossfading: Switch tracks with timed fades, surviving scene loads on persistent entities. - Headless simulation: Under Node, playback is simulated from the frame delta, so isPlaying, fades, and onEnded work in tests without a browser. - Use Case: Add footsteps with randomized pitch capped at eight concurrent instances, position a looping torch sound in the world, and crossfade menu music into battle music on game start. ## Quick Start Add the audio extension when creating the ignifx app, load an AudioClip, attach an AudioSource to an entity, and call play to hear the sound.

Frequently Asked Questions about audio

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

FAQPage Schema
How do I play a sound effect in an ignifx game?

Load an AudioClip through app.assets, add an AudioSource component to an entity with that clip, and call play(). For fire-and-forget sounds, use app.audio.playOneShot(clip, options), which defaults to the SFX bus.

How do I add spatial or 3D positional audio in ignifx?

Set spatial: true on an AudioSource along with minDistance, maxDistance, and a distanceModel, and place an AudioListener on the camera entity. The source follows its entity's world position automatically each frame.

Why is there no sound when my browser game starts?

Browsers block audio before a user gesture, so app.audio.state stays "locked" until unlock() is called from a real click handler. Plays made while locked are queued and start in order after the unlock, so nothing is lost.

Can I test ignifx audio in Node without a browser?

Yes, the headless backend simulates playback from the frame delta, so isPlaying, fades, instanceCount, and onEnded all work in tests. Use .wav files, since duration is null for mp3, ogg, webm, and flac under Node.

How do I crossfade background music between scenes?

Add a MusicPlayer component to an entity, call play() with the first track, then crossfadeTo() with the next track and a duration. Put the entity in a persistent scene so the music survives scene loads.

When should an audio clip be marked as streaming?

Mark long tracks like music as streaming by setting audio.streaming to true in the clip's .meta.json sidecar. Streaming plays from a media element instead of decoding the entire file into memory.