> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Silero

> JavaScript API reference for the silero voice activity detection plugin.

## SileroVAD

Silero voice-activity detector (VAD).

### Constructor

```typescript theme={null}
new SileroVAD(opts: SileroVADOptions)
```

<ParamField path="threshold" type="number">
  Speech-probability threshold to start speech, in \[0, 1]. Default `0.4`.
</ParamField>

<ParamField path="startThreshold" type="number | null">
  Overrides threshold when set. Default `null`.
</ParamField>

<ParamField path="endThreshold" type="number | null">
  Overrides stopThreshold when set. Default `null`.
</ParamField>

<ParamField path="stopThreshold" type="number">
  Probability below which speech ends, in \[0, 1]. Default `0.25`.
</ParamField>

<ParamField path="minSpeechDuration" type="number">
  Minimum speech duration in seconds. Default `0.3`.
</ParamField>

<ParamField path="minSilenceDuration" type="number">
  Minimum trailing silence to end a turn, in seconds. Default `0.4`.
</ParamField>

<ParamField path="paddingDuration" type="number">
  Audio padding around detected speech, in seconds. Default `0.5`.
</ParamField>

<ParamField path="maxBufferedSpeech" type="number">
  Maximum buffered speech, in seconds. Default `60.0`.
</ParamField>

<ParamField path="sampleRate" type="number">
  Model sample rate in Hz (used unless modelSampleRate is set). Default `16000`.
</ParamField>

<ParamField path="inputSampleRate" type="number | null">
  Sample rate (Hz) of the incoming audio. Default `null` (treated as `48000`).
</ParamField>

<ParamField path="modelSampleRate" type="number | null">
  Overrides sampleRate as the model sample rate. Default `null`.
</ParamField>

<ParamField path="smoothingFactor" type="number">
  Exponential smoothing factor for speech probability. Default `0.35`.
</ParamField>

<ParamField path="forceCpu" type="boolean">
  Force CPU inference. Default `false`.
</ParamField>

<ParamField path="minVolume" type="number">
  Minimum input volume gate; ignored unless energyFilterEnabled. Default `0.0`.
</ParamField>

<ParamField path="energyFilterEnabled" type="boolean">
  Enable the energy/volume gate. Default `true`. When `false`, `minVolume` is forced to `0.0`.
</ParamField>

### close

```typescript theme={null}
close(): Promise<void>
```

Release any resources held by the provider.

### closeEmitter

```typescript theme={null}
closeEmitter(): Promise<void>
```

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds
for in-flight async handlers to settle before returning.

### emit

```typescript theme={null}
emit(event: string, ...args: any[]): void
```

<ParamField path="event" type="string" required />

### flush

```typescript theme={null}
flush(): Promise<void>
```

Flush any buffered audio.

### getRuntimeConfig

```typescript theme={null}
getRuntimeConfig(): Record<string, any>
```

<ResponseField name="returns" type="Record<string, any>" />

### listenerCount

```typescript theme={null}
listenerCount(event: string): number
```

<ParamField path="event" type="string" required />

<ResponseField name="returns" type="number" />

### off

```typescript theme={null}
off(event: string, handler: EventHandler): void
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

### on

```typescript theme={null}
on(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### once

```typescript theme={null}
once(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### onVadEvent

```typescript theme={null}
onVadEvent(callback: VadEventCallback): void
```

Register a callback to receive VADResponse events.

<ParamField path="callback" type="VadEventCallback" required />

### processAudio

```typescript theme={null}
processAudio(_audioFrames: Uint8Array, ..._extra: any[]): Promise<void>
```

Process a buffer of audio frames. Override in a custom provider.

### removeAllListeners

```typescript theme={null}
removeAllListeners(event?: string): void
```

<ParamField path="event" type="string" />
