Skip to content

Class: WorkletPcmSource

Defined in: aiui-intent-runtime/src/audio.ts:197

The real PcmSource: getUserMedia → AudioContext → AudioWorklet, tapping mono Float32 at the context rate, resampled to 24 kHz Int16 in ~120 ms frames. Everything DOM/Web-Audio lives inside start so importing this in jsdom is safe (only start touches APIs jsdom lacks; it returns false there).

Implements

Constructors

Constructor

new WorkletPcmSource(options?): WorkletPcmSource

Defined in: aiui-intent-runtime/src/audio.ts:202

Parameters

options?
workletUrl?

string

Returns

WorkletPcmSource

Methods

dispose()

dispose(): void

Defined in: aiui-intent-runtime/src/audio.ts:329

Release the mic + audio graph.

Returns

void

Implementation of

PcmSource.dispose


level()

level(): number

Defined in: aiui-intent-runtime/src/audio.ts:297

0..1 RMS-ish level for the meter; 0 when not capturing.

Returns

number

Implementation of

PcmSource.level


setMuted()

setMuted(muted): void

Defined in: aiui-intent-runtime/src/audio.ts:311

See PcmSource.setMuted: silence the track, keep the frames.

Parameters

muted

boolean

Returns

void

Implementation of

PcmSource.setMuted


start()

start(onFrame): Promise<boolean>

Defined in: aiui-intent-runtime/src/audio.ts:215

Acquire the mic + worklet and start emitting frames. False if unavailable.

Parameters

onFrame

(frame) => void

Returns

Promise<boolean>

Implementation of

PcmSource.start


stop()

stop(): Promise<void>

Defined in: aiui-intent-runtime/src/audio.ts:282

Stop emitting; resolves after the final (partial) frame is delivered.

Returns

Promise<void>

Implementation of

PcmSource.stop