# Difference Between `--min_speech_ms` and `--min_speech_continuation_ms` VAD Parameters

> Understand the difference between min_speech_ms and min_speech_continuation_ms VAD parameters. Learn how these settings control speech turn detection and prevent utterance splitting in speech-to-speech.

- Repository: [Hugging Face/speech-to-speech](https://github.com/huggingface/speech-to-speech)
- Tags: deep-dive
- Published: 2026-08-08

---

**While `--min_speech_ms` defines the minimum duration required to trigger a new speech turn, `--min_speech_continuation_ms` acts as a lower hysteresis threshold for extending a turn that hasn't been fully committed, preventing the system from splitting continuous utterances during brief pauses.**

The Hugging Face `speech-to-speech` repository implements a Voice Activity Detection (VAD) state machine to manage conversational turn-taking. These two **VAD parameters** work in tandem to balance sensitivity against false triggers, with distinct roles in the speech segmentation logic found in [`vad_arguments.py`](https://github.com/huggingface/speech-to-speech/blob/main/vad_arguments.py) and [`vad_handler.py`](https://github.com/huggingface/speech-to-speech/blob/main/vad_handler.py).

## Starting New Turns with `--min_speech_ms`

The `--min_speech_ms` parameter (default **384 ms**) establishes the minimum length of continuous speech required before the pipeline emits a `SpeechStartedEvent` and opens a new conversational turn. This threshold filters out transient noises, breath sounds, or accidental utterances that should not initiate a response cycle.

In `VADHandlerArguments`, this value is mapped to the `min_speech_ms` field. The `VADHandler` class retrieves this baseline threshold through the `_active_speech_min_ms` method when evaluating whether sufficient speech has accumulated to declare a brand-new turn. If the detected active speech duration falls below this value, the audio chunk is discarded or buffered without triggering the downstream speech-to-text pipeline.

## Continuing Turns with `--min_speech_continuation_ms`

The `--min_speech_continuation_ms` parameter (default **192 ms**) provides a shorter, secondary threshold specifically for turns that are "soft-ended" or pending reopen. When a user pauses briefly but hasn't finished speaking, this hysteresis value allows the system to accept a shorter burst of speech to continue the existing turn rather than treating it as a new interaction.

According to the source code in [`vad_handler.py`](https://github.com/huggingface/speech-to-speech/blob/main/vad_handler.py), this value is resolved through `_resolve_min_speech_continuation_ms`, which clamps the input to the range `[100, min_speech_ms]`. If the parameter is set to `0` or a negative value, the method falls back to using `min_speech_ms`, effectively disabling the continuation relaxation.

## Threshold Selection Logic in [`vad_handler.py`](https://github.com/huggingface/speech-to-speech/blob/main/vad_handler.py)

The `VADHandler` dynamically selects between these two thresholds via the `_active_speech_min_ms` method. During execution, the handler checks whether the current turn state is reopenable or pending a reopen. If so, it returns the `min_speech_continuation_ms` value; otherwise, it enforces the stricter `min_speech_ms` requirement.

This state-aware approach ensures that:
- **New speech** must satisfy the higher `min_speech_ms` bar to start a turn.
- **Continuations** during tentative turn closures only need to satisfy the lower `min_speech_continuation_ms` bar.

## Configuration Examples

You can adjust these VAD parameters when launching the realtime server or instantiating the handler programmatically.

**Command-line usage with CLI flags (`--minspeechms` and `--minspeechcontinuationms`):**

```bash
python -m speech_to_speech.server \
    --thresh 0.7 \
    --minspeechms 500 \
    --minspeechcontinuationms 250

```

**Programmatic configuration using `VADHandlerArguments`:**

```python
from speech_to_speech.arguments_classes.vad_arguments import VADHandlerArguments

args = VADHandlerArguments(
    min_speech_ms=500,
    min_speech_continuation_ms=250,
)
handler = VADHandler(**args.__dict__)

```

The default value of **192 ms** for continuation is explicitly recommended as approximately half of the default **384 ms** new-turn threshold, providing a balanced trade-off between responsiveness and turn stability.

## Summary

- **`--min_speech_ms`** (default 384 ms) sets the strict minimum for detecting the start of a new speech turn, preventing false triggers from brief noises.
- **`--min_speech_continuation_ms`** (default 192 ms) provides a lower hysteresis threshold for extending turns that haven't been fully committed, improving conversational flow.
- The `_resolve_min_speech_continuation_ms` method enforces a valid range of `[100, min_speech_ms]` and falls back to `min_speech_ms` if the continuation value is ≤ 0.
- The `_active_speech_min_ms` method dynamically returns the appropriate threshold based on whether the current turn is reopenable.

## Frequently Asked Questions

### What happens if I set `--min_speech_continuation_ms` to 0?

The `_resolve_min_speech_continuation_ms` method in [`vad_handler.py`](https://github.com/huggingface/speech-to-speech/blob/main/vad_handler.py) treats values ≤ 0 as invalid and falls back to using `min_speech_ms`. This means both new turns and continuations will require the same minimum speech duration, effectively disabling the continuation hysteresis.

### Why is `--min_speech_continuation_ms` clamped to a minimum of 100ms?

The clamping logic prevents users from setting overly aggressive continuation thresholds that could capture background noise or non-speech artifacts. By enforcing a floor of 100ms in `_resolve_min_speech_continuation_ms`, the system maintains a baseline level of signal quality before considering a turn extension valid.

### Can `--min_speech_continuation_ms` be higher than `--min_speech_ms`?

No. The resolution method explicitly clamps the continuation value to the inclusive range `[100, min_speech_ms]`. If you attempt to set a higher value, it will be capped at the `min_speech_ms` value, ensuring that continuation logic never requires more speech than starting a fresh turn.

### Where are these VAD parameters defined in the source code?

The parameters are defined in **[`src/speech_to_speech/arguments_classes/vad_arguments.py`](https://github.com/huggingface/speech-to-speech/blob/main/src/speech_to_speech/arguments_classes/vad_arguments.py)** within the `VADHandlerArguments` class. The runtime logic that consumes these values, including `_active_speech_min_ms` and `_resolve_min_speech_continuation_ms`, resides in **[`src/speech_to_speech/VAD/vad_handler.py`](https://github.com/huggingface/speech-to-speech/blob/main/src/speech_to_speech/VAD/vad_handler.py)**.