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

# Voice Focus

Isolate the primary voice and suppress background noise on streaming transcription.

Voice Focus is available on AssemblyAI-STT-3.7-Realtime-Agent and Universal-3.6 Pro Realtime. It isn't available on AssemblyAI-STT-3.7-Realtime.

Hear the speaker, not the room. Voice Focus isolates the primary voice and suppresses background chatter, keyboard clicks, fan hum, and room echo before the audio reaches the transcription model.

## Variants

Pick the variant based on how close the speaker is to the microphone.

| Variant | Value | When to use |
| - | - | - |
| Near field | `near-field` | Headsets, handsets, and other close-talking microphones. |
| Far field | `far-field` | Conference rooms, drive-thru speakers, laptop mics, and other distant capture setups. |

## Tuning parameters

Tune how aggressively each variant suppresses background audio with the following parameter.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `voice_focus_threshold` | float | `0.5` | Optional. A float between `0.0` and `1.0` that controls how aggressively background audio is suppressed. Higher values are more aggressive. Defaults to `0.5` for both variants. |

## Quickstart

Set the `voice_focus` connection parameter when you open the WebSocket. See [Tuning parameters](#tuning-parameters) to adjust how aggressively background audio is suppressed.

> [tab] Python
>
> ```python theme={null}
> CONNECTION_PARAMS = {
>     "sample_rate": 16000,
>     "speech_model": "assemblyai-stt-3-7-realtime-agent",
>     "voice_focus": "near-field",
>     # "voice_focus_threshold": 0.5,  # Optional, defaults to 0.5. Higher is more aggressive.
> }
> ```

> [tab] Python SDK
>
> ```python theme={null}
> client.connect(
>     RealTimeParameters(
>         sample_rate=16000,
>         speech_model="assemblyai-stt-3-7-realtime-agent",
>         voice_focus="near-field",
>         # voice_focus_threshold=0.5,  # Optional, defaults to 0.5. Higher is more aggressive.
>     )
> )
> ```

> [tab] Javascript
>
> ```javascript theme={null}
> const CONNECTION_PARAMS = {
>   sample_rate: 16000,
>   speech_model: "assemblyai-stt-3-7-realtime-agent",
>   voice_focus: "near-field",
>   // voice_focus_threshold: 0.5, // Optional, defaults to 0.5. Higher is more aggressive.
> };
> ```

> [tab] JavaScript SDK
>
> ```javascript theme={null}
> const transcriber = client.streaming.transcriber({
>   sampleRate: 16_000,
>   speechModel: "assemblyai-stt-3-7-realtime-agent",
>   voiceFocus: "near-field",
>   // voiceFocusThreshold: 0.5, // Optional, defaults to 0.5. Higher is more aggressive.
> });
> ```
