EZ Web Audio / createSprite
Function: createSprite()
createSprite(
audioUrl,manifest):Promise<AudioSprite>
Defined in: index.ts:435
Create an audio sprite from an audio file and manifest. Sprites allow playing segments of a single audio file by name.
Parameters
audioUrl
string
URL of the audio file
manifest
Sprite manifest with timing definitions
Returns
Promise<AudioSprite>
AudioSprite instance
Example
ts
const sprite = await createSprite('sounds.mp3', {
spritemap: {
laser: { start: 0, end: 0.3 },
explosion: { start: 1.0, end: 2.5 }
}
})
sprite.play('laser', { gain: 0.5 })