We've been using sound sprites with Hawler.js but it's great that PixiJS Sound supports it in the first place too, and we're considering switch to it. Currently, we compress and generate the sound sprites with gulp-audiosprite and a custom gulp script. It would be nice if Asset Pack could do that for us so we can automate this process.
Expected Behaviour
All raw sounds with .wav file format are in raw-assets folder, with a sps tag for example. Asset Pack packs and compresses them into merged sound files in different file formats, and a .json config file.
P.S. If Cache Buster is used, the sound files should also include the hash and update every time the raw files change.
Further Implementation (in Pixi-Sound)
This is optional but great to have so manual code can be reduced. PixiJS Sound should understand the manifest generated, and create the sound sprite from the .json config file, which is ready to be used to play the sound.
// Init the manifest
PIXI.Assets.init({ manifest });
// Load the bundle
const loadingScreenAssets = await PIXI.Assets.loadBundle('loading-screen');
// Create a new sound
const sound = PIXI.sound.Sound.from(loadingScreenAssets.sounds);
// Pixi should automatically recognize the sound spritesheet and add all sprites
// No need for explicit sound.addSprites({...})
// Use the sprite alias to play
sound.play('bgm_main');
We've been using sound sprites with Hawler.js but it's great that PixiJS Sound supports it in the first place too, and we're considering switch to it. Currently, we compress and generate the sound sprites with
gulp-audiosprite
and a custom gulp script. It would be nice if Asset Pack could do that for us so we can automate this process.Expected Behaviour
All raw sounds with
.wav
file format are inraw-assets
folder, with asps
tag for example. Asset Pack packs and compresses them into merged sound files in different file formats, and a.json
config file.P.S. If Cache Buster is used, the sound files should also include the hash and update every time the raw files change.
Further Implementation (in Pixi-Sound)
This is optional but great to have so manual code can be reduced. PixiJS Sound should understand the manifest generated, and create the sound sprite from the
.json
config file, which is ready to be used to play the sound.Here’s a sample
sounds.json
file:I've also submitted this feature request to Pixi-Sound.