Skip to main content
def voices_clone(client: Cartesia, *args: str) -> "VoiceMetadata":
    """Clone a voice from an audio clip."""
    import sys

    if len(args) < 2:
        print("Usage: voices_clone <path to audio file> <language> [<name>]")
        print(
            "See https://docs.cartesia.ai/build-with-cartesia/tts-models/latest for supported languages: en, fr, de, es, ..."
        )
        sys.exit(1)
    clip_path, language, *name_parts = args
    name = " ".join(name_parts) if name_parts else "My Voice"
    with open(clip_path, "rb") as clip:
        voice = client.voices.clone(
            clip=clip,
            language=language,
            name=name,
        )
    print(f"Cloned voice: {voice.id}")
    return voice
From cartesia-python/examples/examples.py:529

Run this example

git clone --branch v3.2.0 https://github.com/cartesia-ai/cartesia-python
cd cartesia-python
uv sync
CARTESIA_API_KEY=YOUR_KEY uv run examples/examples.py voices_clone path/to/clip.wav en "My Voice"