@fogrexon/glyph-arena-audio

Web Audio playback helper. See also package README.

Exports

Generated from the package's source when the docs are built — do not edit this table by hand.

NameKind
Audiotype
CreateAudioOptionstype
PlayHandletype
PlayOptionstype
createAudiofunction

createAudio(options?)

const audio = createAudio({ context? });

const buffer = await audio.decode(bytes);
const handle = audio.play(buffer, { gain?, loop? });

audio.stop(handle);
await audio.resume();
audio.dispose();

Options

Methods

PlayOptions

FieldDescription
gain?volume multiplier, clamped to 0..1. Default 1.
loop?loop playback. Default false.

After dispose()

Suspended context

play while the context is suspended still creates sources and returns a handle. Call resume() to unpause the context.