Type Alias: FsmnVoiceActivityDetector
FsmnVoiceActivityDetector =
object
Defined in: extensions/speech/tasks/fsmnVoiceActivityDetection.ts:180
Voice activity detection task runner using the FSMN-VAD model.
Properties
detectVoice()
readonlydetectVoice: (waveform,options?) =>Promise<VadSegment[]>
Defined in: extensions/speech/tasks/fsmnVoiceActivityDetection.ts:196
Asynchronously detects speech segments within a mono waveform sampled at FSMN_VAD_SAMPLE_RATE_HZ.
Parameters
waveform
Float32Array
The input audio samples (16 kHz mono Float32 PCM).
options?
Optional per-call overrides of the detection thresholds. See VadOptions.
Returns
Promise<VadSegment[]>
A promise resolving to the detected speech segments, in seconds.
Throws
With code RESOURCE_BUSY if the model is in
use, or RESOURCE_DISPOSED if disposed.
detectVoiceOnStream()
readonlydetectVoiceOnStream: (chunk,options?) =>VadEvent|undefined
Defined in: extensions/speech/tasks/fsmnVoiceActivityDetection.ts:217
Appends a live audio chunk to a bounded rolling window, runs detection over
that window and reports a VadEvent when speech starts or stops,
otherwise undefined. Designed to be driven straight from a recorder
callback. Detection runs synchronously on the calling thread (a few ms).
Parameters
chunk
Float32Array
The newly captured audio samples (16 kHz mono Float32 PCM).
options?
Optional overrides of the detection thresholds and margin. See VadStreamOptions.
Returns
VadEvent | undefined
'speechStart' or 'speechEnd' if state transitioned, otherwise
undefined.
Throws
With code RESOURCE_BUSY if the model is in
use, or RESOURCE_DISPOSED if disposed.
detectVoiceWorklet()
readonlydetectVoiceWorklet: (waveform,options?) =>VadSegment[]
Defined in: extensions/speech/tasks/fsmnVoiceActivityDetection.ts:202
Synchronous version of detectVoice to be executed directly on the caller or worklet thread.
Parameters
waveform
Float32Array
options?
Returns
dispose()
readonlydispose: () =>void
Defined in: extensions/speech/tasks/fsmnVoiceActivityDetection.ts:184
Releases all allocated native resources.
Returns
void
resetStream()
readonlyresetStream: () =>void
Defined in: extensions/speech/tasks/fsmnVoiceActivityDetection.ts:225
Clears the rolling window and speaking state used by detectVoiceOnStream.
Returns
void