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

# Clone a Voice

> Clone a voice from an audio clip.

> [tab] Python
>
> ```python theme={null}
> 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](https://github.com/cartesia-ai/cartesia-python/blob/v4.0.1/examples/examples.py#L529)

> [tab] TypeScript
>
> ```typescript theme={null}
> async function voicesClone(client: Cartesia, args: string[]): Promise<void> {
>   const [clipPath, language, ...nameParts] = args;
>   if (!clipPath || !language) {
>     console.error('Usage: voicesClone <path to audio file> <language> <name>');
>     console.error(
>       'See https://docs.cartesia.ai/build-with-cartesia/tts-models/latest for supported languages: en, fr, de, es, ...',
>     );
>     process.exit(1);
>   }
>   const clip = fs.createReadStream(clipPath);
>   const voice = await client.voices.clone({
>     clip,
>     language,
>     name: nameParts.length > 0 ? nameParts.join(' ') : 'My Voice',
>   });
>   console.log('Cloned voice:', voice.id);
> }
> ```
>
> From [cartesia-js/examples/node\_examples.ts:571](https://github.com/cartesia-ai/cartesia-js/blob/v4.0.1/examples/node_examples.ts#L571)

## Run this example

> [tab] Python
>
> ```sh theme={null}
> git clone --branch v4.0.1 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"
> ```

> [tab] TypeScript
>
> ```sh theme={null}
> git clone --branch v4.0.1 https://github.com/cartesia-ai/cartesia-js
> cd cartesia-js
> pnpm i
> CARTESIA_API_KEY=YOUR_KEY pnpm tsn examples/node_examples.ts voicesClone path/to/clip.wav en "My Voice"
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.