Skip to content

Documentation / @debuffjp/audio / Audio

Class: Audio ​

Defined in: index.ts:48

Constructors ​

Constructor ​

new Audio(): Audio

Defined in: index.ts:55

Returns ​

Audio

Properties ​

ctx ​

readonly ctx: AudioContext

Defined in: index.ts:49

Accessors ​

unlocked ​

Get Signature ​

get unlocked(): boolean

Defined in: index.ts:74

Returns ​

boolean

Methods ​

decode() ​

decode(id, data): Promise<void>

Defined in: index.ts:78

Parameters ​

id ​

string

data ​

ArrayBuffer

Returns ​

Promise<void>


has() ​

has(id): boolean

Defined in: index.ts:83

Parameters ​

id ​

string

Returns ​

boolean


play() ​

play(id, options?): Voice

Defined in: index.ts:87

Parameters ​

id ​

string

options? ​

PlayOptions = {}

Returns ​

Voice


stream() ​

stream(url, options?): Stream

Defined in: index.ts:143

Stream a long track (music, ambience) through an <audio> element into a bus. Unlike play, it isn't decoded into memory up front, so it starts immediately and stays light on mobile. If audio is still locked by the browser's autoplay policy, playback starts on the first gesture.

Parameters ​

url ​

string

options? ​

StreamOptions = {}

Returns ​

Stream


synth() ​

synth(o): Voice

Defined in: index.ts:107

Synthesize a short blip/zap/hit without any asset.

Parameters ​

o ​

SynthOptions

Returns ​

Voice


volume() ​

volume(bus, value): void

Defined in: index.ts:188

Parameters ​

bus ​

Bus | "master"

value ​

number

Returns ​

void