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

# ChatterboxMultilingualTTS

> API reference for the ChatterboxMultilingualTTS class

## Overview

`ChatterboxMultilingualTTS` extends Chatterbox's capabilities to 23 languages with high-quality voice cloning and synthesis. It supports cross-lingual voice cloning, allowing you to clone a voice in one language and synthesize speech in another.

## Class Signature

```python theme={null}
class ChatterboxMultilingualTTS:
    def __init__(
        self,
        t3: T3,
        s3gen: S3Gen,
        ve: VoiceEncoder,
        tokenizer: MTLTokenizer,
        device: str,
        conds: Conditionals = None,
    )
```

## Parameters

<ParamField path="t3" type="T3" required>
  The T3 text-to-speech tokens model instance configured for multilingual support
</ParamField>

<ParamField path="s3gen" type="S3Gen" required>
  The S3Gen vocoder model instance for token-to-audio conversion
</ParamField>

<ParamField path="ve" type="VoiceEncoder" required>
  Voice encoder for extracting speaker embeddings from reference audio
</ParamField>

<ParamField path="tokenizer" type="MTLTokenizer" required>
  Multilingual text tokenizer instance
</ParamField>

<ParamField path="device" type="str" required>
  Device to run inference on ("cuda", "cpu", or "mps")
</ParamField>

<ParamField path="conds" type="Conditionals">
  Optional pre-computed conditionals for voice and style. See [Conditionals](/api/conditionals) reference
</ParamField>

## Class Methods

### from\_pretrained()

Load the pre-trained ChatterboxMultilingualTTS model from Hugging Face.

```python theme={null}
@classmethod
def from_pretrained(cls, device: str) -> 'ChatterboxMultilingualTTS'
```

#### Parameters

<ParamField path="device" type="str" required>
  Device to load the model on ("cuda", "cpu", or "mps")
</ParamField>

#### Returns

<ResponseField name="model" type="ChatterboxMultilingualTTS">
  Initialized ChatterboxMultilingualTTS model with pre-trained weights from `ResembleAI/chatterbox`
</ResponseField>

#### Example

```python theme={null}
from chatterbox import ChatterboxMultilingualTTS
import torch

# Load on GPU
device = "cuda" if torch.cuda.is_available() else "cpu"
model = ChatterboxMultilingualTTS.from_pretrained(device)
```

### from\_local()

Load the model from a local checkpoint directory.

```python theme={null}
@classmethod
def from_local(cls, ckpt_dir: str, device: str) -> 'ChatterboxMultilingualTTS'
```

#### Parameters

<ParamField path="ckpt_dir" type="str" required>
  Path to the directory containing model checkpoint files
</ParamField>

<ParamField path="device" type="str" required>
  Device to load the model on ("cuda", "cpu", or "mps")
</ParamField>

#### Returns

<ResponseField name="model" type="ChatterboxMultilingualTTS">
  Initialized ChatterboxMultilingualTTS model with weights loaded from local directory
</ResponseField>

### get\_supported\_languages()

Return a dictionary of all supported language codes and their names.

```python theme={null}
@classmethod
def get_supported_languages(cls) -> dict
```

#### Returns

<ResponseField name="languages" type="dict">
  Dictionary mapping language codes to language names. See [Supported Languages](/api/supported-languages) for the full list
</ResponseField>

#### Example

```python theme={null}
languages = ChatterboxMultilingualTTS.get_supported_languages()
print(languages)
# {'ar': 'Arabic', 'da': 'Danish', 'de': 'German', ...}
```

## Instance Methods

### prepare\_conditionals()

Prepare voice conditionals from an audio prompt for subsequent generation calls.

```python theme={null}
def prepare_conditionals(
    self,
    wav_fpath: str,
    exaggeration: float = 0.5
)
```

#### Parameters

<ParamField path="wav_fpath" type="str" required>
  Path to the audio file to use as voice reference
</ParamField>

<ParamField path="exaggeration" type="float" default="0.5">
  Voice exaggeration level (0.0 to 1.0). Higher values produce more expressive speech
</ParamField>

#### Example

```python theme={null}
# Prepare voice from reference audio
model.prepare_conditionals(
    wav_fpath="voice_sample.wav",
    exaggeration=0.5
)
```

### generate()

Generate speech from text in the specified language using the prepared voice conditionals.

```python theme={null}
def generate(
    self,
    text: str,
    language_id: str,
    audio_prompt_path: str = None,
    exaggeration: float = 0.5,
    cfg_weight: float = 0.5,
    temperature: float = 0.8,
    repetition_penalty: float = 2.0,
    min_p: float = 0.05,
    top_p: float = 1.0,
) -> torch.Tensor
```

#### Parameters

<ParamField path="text" type="str" required>
  The text to convert to speech
</ParamField>

<ParamField path="language_id" type="str" required>
  Language code for the text (e.g., "en", "es", "fr"). See [Supported Languages](/api/supported-languages) for valid codes
</ParamField>

<ParamField path="audio_prompt_path" type="str">
  Optional path to audio file for voice cloning. If provided, will override existing conditionals
</ParamField>

<ParamField path="exaggeration" type="float" default="0.5">
  Voice exaggeration level (0.0 to 1.0). Higher values produce more expressive and animated speech
</ParamField>

<ParamField path="cfg_weight" type="float" default="0.5">
  Classifier-free guidance weight (0.0 to 1.0+). Higher values increase adherence to conditioning
</ParamField>

<ParamField path="temperature" type="float" default="0.8">
  Sampling temperature (higher = more random, lower = more deterministic)
</ParamField>

<ParamField path="repetition_penalty" type="float" default="2.0">
  Penalty for repeating tokens (1.0 = no penalty, higher values discourage repetition)
</ParamField>

<ParamField path="min_p" type="float" default="0.05">
  Minimum probability threshold for sampling. Filters out tokens below this probability
</ParamField>

<ParamField path="top_p" type="float" default="1.0">
  Nucleus sampling threshold (0.0 to 1.0). Only tokens with cumulative probability up to top\_p are considered
</ParamField>

#### Returns

<ResponseField name="audio" type="torch.Tensor">
  Generated audio waveform as a PyTorch tensor with shape `[1, samples]`. Sample rate is 44100 Hz (accessible via `model.sr`). Audio includes perceptual watermarking
</ResponseField>

#### Example

```python theme={null}
import torchaudio
from chatterbox import ChatterboxMultilingualTTS, SUPPORTED_LANGUAGES

device = "cuda"
model = ChatterboxMultilingualTTS.from_pretrained(device)

# Generate French speech
audio = model.generate(
    text="Bonjour, comment allez-vous?",
    language_id="fr",
    audio_prompt_path="french_voice.wav",
    exaggeration=0.6
)

torchaudio.save("french_output.wav", audio, model.sr)

# Cross-lingual voice cloning: English voice speaking Spanish
model.prepare_conditionals("english_voice.wav")
audio = model.generate(
    text="Hola, ¿cómo estás?",
    language_id="es",
    exaggeration=0.5
)

torchaudio.save("spanish_output.wav", audio, model.sr)
```

## Attributes

<ResponseField name="sr" type="int">
  Sample rate of generated audio (44100 Hz)
</ResponseField>

<ResponseField name="device" type="str">
  Device the model is running on
</ResponseField>

<ResponseField name="conds" type="Conditionals">
  Current voice conditionals used for generation
</ResponseField>

## Notes

* Supports 23 languages with cross-lingual voice cloning capabilities
* Language code validation is performed automatically - invalid codes will raise a `ValueError`
* Generated audio is automatically watermarked using the Perth implicit watermarker
* Text is automatically normalized for the target language (capitalization, punctuation)
* The exaggeration parameter can be updated on-the-fly without re-preparing conditionals
* Higher repetition\_penalty (default 2.0) helps prevent repetition in multilingual synthesis
