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;

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

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