Type Alias BpxSoundAsset

BpxSoundAsset: {
    audioBuffer: AudioBuffer;
}

Type declaration

  • audioBuffer: AudioBuffer

    The actual sound data.

const musicUrl: BpxSoundUrl = "music.flac"; // refers to `./public/music.flac`
const sfxUrl: BpxSoundUrl = "https://the.url/of/sfx.wav";

let playback1: BpxAudioPlaybackId;
let playback2: BpxAudioPlaybackId;

$x.setOnStarted(() => {
playback1 = $x.startPlayback(musicUrl);
playback2 = $x.startPlayback(sfxUrl);
});

$x.start({
// ...,
assets: [
musicUrl,
sfxUrl,
],
});