Is it possible to play two sounds at once from a soundsprite?

I worked around the background music interrupted by loading it on its own file, but can I play two sounds from the same sound sprite at once?

If you’re using HTML5Audio you need to pass, e.g., { instances: 2 } (or more) in the load call.

If you’re using WebAudio it should just work.

1 Like

It doesn’t seem to work for WebAudio. If you play any other sound form the sprite sheet, the other one stops.

I’m doing this now:

var soundsprite1 = this.sound.addAudioSprite('soundsprite')
var soundsprite2 = this.sound.addAudioSprite('soundsprite')
var soundsprite3 = this.sound.addAudioSprite('soundsprite')
var soundsprite4 = this.sound.addAudioSprite('soundsprite')
var soundsprite5 = this.sound.addAudioSprite('soundsprite')
var soundsprite6 = this.sound.addAudioSprite('soundsprite')

Annoying, but better than bouncing out individual sounds.

Oh, for Web Audio you can do

this.sound.playAudioSprite('key', 'name1');
this.sound.playAudioSprite('key', 'name2');
// etc.
1 Like