@yagejs/audio
v0.1.0
Published
Sound loading, playback, and channel mixing for YAGE
Downloads
50
Maintainers
Readme
@yagejs/audio
Sound loading, playback, and channel mixing for the YAGE 2D game engine.
Install
npm install @yagejs/audioBundles @pixi/sound - no separate install required.
Usage
import { Engine } from "@yagejs/core";
import { AudioPlugin, sound } from "@yagejs/audio";
const engine = new Engine();
engine.use(new AudioPlugin({
channels: {
music: { volume: 0.7 },
sfx: { volume: 1.0 },
},
}));Play sounds via the asset system or a SoundComponent:
const jumpSfx = sound("jump.mp3");
entity.add(new SoundComponent({ source: jumpSfx, channel: "sfx" }));What's in the box
- AudioPlugin / AudioManager - sound loading and playback
- SoundComponent - attach sounds to entities with auto-cleanup
- Channels - per-channel volume, mute, ducking
- Spatial options - 2D positional audio via pan
Docs
Full documentation at yage.dev.
License
MIT
