Interface: AudioSource
Defined in: types.ts:133
An injected audio producer — the microphone, a file player, a test script. The engine consumes frames the way SpeechPlayer consumes an injected sink: same inversion, source instead of sink. Both engines take 24 kHz PCM16 mono, so one capture path serves either.
Properties
sampleRate
readonlysampleRate:number
Defined in: types.ts:135
Samples per second of the produced PCM16. Both engines want 24000.
Methods
flush()?
optionalflush():void
Defined in: types.ts:145
Emit the buffered partial frame NOW. The handle calls this at segment end, before the commit — a warm mic buffering ~100 ms frames would otherwise clip the segment's tail off every utterance.
Returns
void
level()?
optionallevel():number
Defined in: types.ts:147
Latest frame's level, 0–1 (for meters). Optional.
Returns
number
start()
start(
onFrame):Promise<void>
Defined in: types.ts:137
Begin producing; each frame is little-endian PCM16 mono bytes.
Parameters
onFrame
(pcm16) => void
Returns
Promise<void>
stop()
stop():
void
Defined in: types.ts:139
Stop producing (idempotent). Releases the device for a real mic.
Returns
void