> ## 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

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

<Card title="Usage guide" icon="book" href="/plugins/vad/silero" horizontal>
  Setup, environment variables, and Python/JavaScript/Go usage examples.
</Card>

## SileroVAD

Abstract base class for voice activity detection providers.

Implementations analyze audio to detect speech and silence boundaries and
may emit `'error'` and `'info'` events.

### Constructor

```python theme={null}
SileroVAD(*, threshold: 'float' = 0.4, start_threshold: 'Optional[float]' = None, end_threshold: 'Optional[float]' = None, stop_threshold: 'float' = 0.25, min_speech_duration: 'float' = 0.3, min_silence_duration: 'float' = 0.4, padding_duration: 'float' = 0.5, max_buffered_speech: 'float' = 60.0, sample_rate: 'int' = 16000, input_sample_rate: 'Optional[int]' = None, model_sample_rate: 'Optional[int]' = None, smoothing_factor: 'float' = 0.35, **kwargs: 'Any') -> 'None'
```

<ParamField path="threshold" type="float" default="0.4">
  Speech probability threshold above which audio is treated as speech.
</ParamField>

<ParamField path="start_threshold" type="Optional[float]" />

<ParamField path="end_threshold" type="Optional[float]" />

<ParamField path="stop_threshold" type="float" default="0.25" />

<ParamField path="min_speech_duration" type="float" default="0.3">
  Minimum duration, in seconds, required to confirm a speech segment.
</ParamField>

<ParamField path="min_silence_duration" type="float" default="0.4">
  Minimum duration, in seconds, required to confirm a silence segment.
</ParamField>

<ParamField path="padding_duration" type="float" default="0.5" />

<ParamField path="max_buffered_speech" type="float" default="60.0" />

<ParamField path="sample_rate" type="int" default="16000">
  Sample rate of the input audio, in Hz.
</ParamField>

<ParamField path="input_sample_rate" type="Optional[int]" />

<ParamField path="model_sample_rate" type="Optional[int]" />

<ParamField path="smoothing_factor" type="float" default="0.35" />

### aclose

```python theme={null}
def aclose(self) -> 'None'
```

Release any resources held by the provider.

### emit

```python theme={null}
def emit(self, event: 'T', *args: 'Any') -> 'None'
```

Emit an event, invoking all registered handlers with the given arguments.

Handlers are called in registration order. Coroutine handlers are
scheduled on the running event loop. If the emitter is closed, the call
is a no-op.

<ParamField path="event" type="T" required>
  The event to emit.
</ParamField>

### flush

```python theme={null}
def flush(self) -> 'None'
```

Flush any buffered audio and finalize pending detection state.

### off

```python theme={null}
def off(self, event: 'T', callback: 'Callable[..., Any]') -> 'None'
```

Remove a previously registered handler for an event.

If the handler is not registered for the event, the call is a no-op.

<ParamField path="event" type="T" required>
  The event the handler was registered for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any]" required>
  The handler to remove.
</ParamField>

### on

```python theme={null}
def on(self, event: 'T', callback: 'Callable[..., Any] | None' = None) -> 'Callable[..., Any]'
```

Register a handler for an event.

Can be used directly by passing a callback, or as a decorator when
`callback` is omitted.

<ParamField path="event" type="T" required>
  The event to listen for.
</ParamField>

<ParamField path="callback" type="Callable[..., Any] | None">
  The handler to invoke when the event is emitted. If `None`, a decorator is returned that registers the decorated function.
</ParamField>

<ResponseField name="returns" type="Callable[..., Any]">
  The registered callback when `callback` is provided, otherwise a decorator that registers and returns the function it wraps.
</ResponseField>

### on\_vad\_event

```python theme={null}
def on_vad_event(self, callback: 'Callable[[VADResponse], Awaitable[None]]') -> 'None'
```

Register the coroutine invoked when a voice activity event occurs.

<ParamField path="callback" type="Callable[[VADResponse], Awaitable[None]]" required>
  An async callable that receives each `VADResponse`.
</ParamField>

### process\_audio

```python theme={null}
def process_audio(self, audio_frames: 'bytes', **kwargs: 'Any') -> 'None'
```

Analyze a chunk of audio for voice activity.

Implementations should detect speech and silence transitions and emit
results through the registered voice activity callback.

<ParamField path="audio_frames" type="bytes" required>
  Raw audio bytes to analyze.
</ParamField>
