Skip to content

Latest commit

 

History

History
71 lines (38 loc) · 2.13 KB

File metadata and controls

71 lines (38 loc) · 2.13 KB

Function: useVoiceActivityDetector()

useVoiceActivityDetector(config, options?): object

Defined in: hooks/useVoiceActivityDetector.ts:24

React hook to load and run a Voice Activity Detection (VAD) model.

This hook manages downloading (if remote URLs are provided) and loading the model assets, compiling them, tracking download progress and load errors, and releasing native memory when the component unmounts or the configuration changes.

For imperative usage, see createFsmnVoiceActivityDetector.

Parameters

config

FsmnVadModel

The VAD model configuration. See FsmnVadModel.

options?

ResourceOptions

Load and caching options. See ResourceOptions.

Returns

object

The same object as FsmnVoiceActivityDetector (without dispose), combined with loading state and download progress.

detectVoice

detectVoice: (waveform, options?) => Promise<VadSegment[]> | undefined = model.detectVoice

detectVoiceOnStream

detectVoiceOnStream: (chunk, options?) => VadEvent | undefined | undefined = model.detectVoiceOnStream

detectVoiceWorklet

detectVoiceWorklet: (waveform, options?) => VadSegment[] | undefined = model.detectVoiceWorklet

downloadProgress

downloadProgress: number

error

error: Error | undefined

isReady

isReady: boolean = !!model

resetStream

resetStream: () => void | undefined = model.resetStream

resource

resource: FsmnVadModel | undefined

See

FsmnVoiceActivityDetector