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

# Clone a voice

> Make a voice from a reference clip and wait until it can speak.

Upload a clean reference clip of one speaker and wait for the voice to be ready. 10-30 seconds of
clear speech works best: at least 10 seconds, at most 20 MiB.

<Warning>
  Cloning requires consent. Passing `consent` attests that you are the speaker or hold their
  explicit permission to clone their voice, and the attestation is recorded on the voice. The API
  rejects clones without it.
</Warning>

<CodeGroup>
  ```ts TypeScript theme={null}
  import { fileFromPath } from "@flamai/finesse";

  const voice = await client.voices.cloneAndWait(
    {
      name: "Ana",
      file: await fileFromPath("reference.wav"), // or a Blob/File, bytes, or { data, filename }
      consent: true,
      language: "en",
      labels: { gender: "female", accent: "british" },
      ref_text: "What the speaker says in the clip, if you have it.",
    },
    { onUpdate: (job) => console.log("clone job:", job.status) },
  );
  ```
</CodeGroup>

`clone_and_wait` / `cloneAndWait` creates the voice, uploads the clip, and polls the clone job
until it finishes. The first clone after the cloner has been idle can take a couple of minutes.

## Start now, wait later

<CodeGroup>
  ```ts TypeScript theme={null}
  const clone = await client.voices.clone({
    name: "Ana",
    file: await fileFromPath("reference.wav"),
    consent: true,
  });
  console.log(clone.voice.status, clone.job_id); // "processing", "6660aa00..."
  const ready = await client.voices.waitUntilReady(clone, { timeout: 300_000 });
  ```
</CodeGroup>

On the waiting methods, `timeout` is the overall time to wait for the clone in milliseconds.

## When cloning fails

* `CloneFailedError`: the clone job failed.
* `CloneTimeoutError`: the clone didn't finish in time.

## Add a clip to an existing voice

To add a clip to a voice you already created, enroll it:

<CodeGroup>
  ```ts TypeScript theme={null}
  await client.voices.enroll(voiceId, { file: await fileFromPath("reference.wav"), consent: true });
  ```
</CodeGroup>

The HTTP endpoints behind these methods are [Clone a voice](/voice-api/clone-voice),
[Enroll a voice](/voice-api/enroll-voice) and [Get a job](/voice-api/get-job).


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