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

export const ModelBadges = ({models}) => {
  return <div className="flex flex-wrap gap-2 -mt-3 mb-3 not-prose">
      {models.map(model => <span key={model} className="inline-flex items-center rounded-full bg-green-500/15 px-2.5 py-0.5 text-xs font-mono text-green-700 dark:text-green-400 ring-1 ring-inset ring-green-500/30">
          {model}
        </span>)}
    </div>;
};

<ModelBadges models={["universal-3-5-pro"]} />

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

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.7`   | 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.7` 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.

<Tabs>
  <Tab language="python" title="Python" default>
    ```python theme={null}
    CONNECTION_PARAMS = {
        "sample_rate": 16000,
        "speech_model": "universal-3-5-pro",
        "voice_focus": "near-field",
        # "voice_focus_threshold": 0.7,  # Optional, defaults to 0.7. Higher is more aggressive.
    }
    ```
  </Tab>

  <Tab language="python-sdk" title="Python SDK">
    ```python theme={null}
    client.connect(
        StreamingParameters(
            sample_rate=16000,
            speech_model="universal-3-5-pro",
            voice_focus="near-field",
            # voice_focus_threshold=0.7,  # Optional, defaults to 0.7. Higher is more aggressive.
        )
    )
    ```
  </Tab>

  <Tab language="javascript" title="Javascript">
    ```javascript theme={null}
    const CONNECTION_PARAMS = {
      sample_rate: 16000,
      speech_model: "universal-3-5-pro",
      voice_focus: "near-field",
      // voice_focus_threshold: 0.7, // Optional, defaults to 0.7. Higher is more aggressive.
    };
    ```
  </Tab>

  <Tab language="javascript-sdk" title="JavaScript SDK">
    ```javascript theme={null}
    const transcriber = client.streaming.transcriber({
      sampleRate: 16_000,
      speechModel: "universal-3-5-pro",
      voiceFocus: "near-field",
      // voiceFocusThreshold: 0.7, // Optional, defaults to 0.7. Higher is more aggressive.
    });
    ```
  </Tab>
</Tabs>
