SileroVAD
Local Silero voice-activity-detection engine.
Defined in: src/core/vad/SileroVAD.ts:137
Local Silero voice-activity-detection engine.
Remarks
Stateful across frames — call reset between listening sessions so one session’s trailing state does not bias the next.
Example
const vad = new SileroVAD({ modelUrl: '/models/silero_vad_v5.onnx' });
await vad.initialize();
const probability = await vad.process(frame); // Float32Array(512) @ 16 kHz
if (probability > 0.5) console.log('speech!');
See
- VADEngine for the interface contract
- VADProcessor for the framing/hysteresis layer that drives this engine
Implements
Constructors
Constructor
new SileroVAD(options?): SileroVAD;
Defined in: src/core/vad/SileroVAD.ts:166
Parameters
| Parameter | Type |
|---|---|
options | SileroVADOptions |
Returns
SileroVAD
Properties
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
frameSamples | readonly | 512 | SILERO_FRAME_SAMPLES | Samples per frame the engine expects (e.g. 512 at 16 kHz ≈ 32 ms). | src/core/vad/SileroVAD.ts:138 |
sampleRate | readonly | 16000 | SILERO_SAMPLE_RATE | Sample rate the engine expects, in Hz. | src/core/vad/SileroVAD.ts:139 |
Methods
dispose()
dispose(): Promise<void>;
Defined in: src/core/vad/SileroVAD.ts:294
Release model resources.
Returns
Promise<void>
Implementation of
initialize()
initialize(): Promise<void>;
Defined in: src/core/vad/SileroVAD.ts:178
Load ONNX Runtime and the Silero model, and detect the model version.
Returns
Promise<void>
Throws
ProviderInitializationError when the ONNX Runtime peer dependency is not installed.
Throws
Error when the model cannot be fetched or has an unrecognized input signature.
Implementation of
process()
process(frame): Promise<number>;
Defined in: src/core/vad/SileroVAD.ts:217
Score one 512-sample frame, updating recurrent state.
Parameters
| Parameter | Type | Description |
|---|---|---|
frame | Float32Array | Exactly 512 mono samples in [-1, 1] at 16 kHz. |
Returns
Promise<number>
Speech probability in [0, 1].
Implementation of
reset()
reset(): void;
Defined in: src/core/vad/SileroVAD.ts:286
Clear recurrent state (call between listening sessions).
Returns
void