Skip to main content

Overview

ChatterboxVC enables high-quality voice conversion, transforming the voice characteristics of input audio while preserving the linguistic content. This allows you to change the speaker identity of existing recordings.

Class Signature

Parameters

S3Gen
required
The S3Gen vocoder model instance for audio conversion
str
required
Device to run inference on (“cuda”, “cpu”, or “mps”)
dict
Optional pre-computed reference voice embeddings dictionary

Class Methods

from_pretrained()

Load the pre-trained ChatterboxVC model from Hugging Face.

Parameters

str
required
Device to load the model on (“cuda”, “cpu”, or “mps”). Automatically falls back to “cpu” if MPS is not available

Returns

ChatterboxVC
Initialized ChatterboxVC model with pre-trained weights from ResembleAI/chatterbox

Example

from_local()

Load the model from a local checkpoint directory.

Parameters

str
required
Path to the directory containing model checkpoint files
str
required
Device to load the model on (“cuda”, “cpu”, or “mps”)

Returns

ChatterboxVC
Initialized ChatterboxVC model with weights loaded from local directory

Instance Methods

set_target_voice()

Set the target voice for conversion from an audio file.

Parameters

str
required
Path to the audio file containing the target voice to convert to

Example

generate()

Convert the voice in the input audio to the target voice.

Parameters

str
required
Path to the audio file to convert
str
Optional path to target voice audio file. If provided, will override the existing target voice

Returns

torch.Tensor
Converted audio waveform as a PyTorch tensor with shape [1, samples]. Sample rate is 44100 Hz (accessible via vc_model.sr). Audio includes perceptual watermarking

Example

Attributes

int
Sample rate of generated audio (44100 Hz)
str
Device the model is running on
dict
Current target voice embeddings used for conversion

Notes

  • Voice conversion preserves the linguistic content and prosody while changing voice characteristics
  • The model internally tokenizes the source audio at 16kHz before conversion
  • Generated audio is automatically watermarked using the Perth implicit watermarker
  • Both source and target audio are automatically resampled to the correct sample rates
  • You must either call set_target_voice() first or provide target_voice_path to generate()