Skip to content

Interface: PcmSource

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

A streaming PCM capture source — the realtime path's seam. start begins emitting Int16 mono frames at REALTIME_PCM_RATE; stop flushes the tail and stops; level feeds the meter. Injectable so tests (and jsdom, which has no AudioWorklet) supply a fake in place of WorkletPcmSource.

Methods

dispose()

dispose(): void

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

Release the mic + audio graph.

Returns

void


level()

level(): number

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

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

Returns

number


setMuted()?

optional setMuted(muted): void

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

Mute/unmute the mic mid-stream (M). Optional: a test fake that never acquires a real track has nothing to mute. Frames keep flowing while muted — they are simply silent — so the realtime session's audio timeline stays continuous and the segment keeps its place in the turn.

Parameters

muted

boolean

Returns

void


start()

start(onFrame): Promise<boolean>

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

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

Parameters

onFrame

(frame) => void

Returns

Promise<boolean>


stop()

stop(): Promise<void>

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

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

Returns

Promise<void>