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

# Voice Cloning

> Clone a voice from reference audio with KugelAudio: audio requirements, speaker consent, creating clones in the dashboard or SDK, and managing cloned voices.

Voice cloning lets you create a synthetic voice from reference audio.

## How It Works

1. **Upload reference audio** - Provide clean, representative speech
2. **Processing** - Our AI analyzes the voice characteristics
3. **Voice created** - Use your new voice in any TTS request

## Requirements

### Audio Quality

For best results, your reference audio should be:

- **Format:** WAV, MP3, OGG, M4A, or FLAC
- **File size:** At most 50 MiB per reference
- **Channels:** Mono preferred
- **Quality:** Clean, no background noise

### Content Guidelines

✅ **Good audio:**
- Clear speech with natural pacing
- Single speaker only
- Minimal background noise
- Natural emotional range
- Free of filler words (um, uh, ah, hmm) unless you want them in the output

❌ **Avoid:**
- Multiple speakers
- Background music
- Heavy reverb or echo
- Whispered or shouted speech
- Heavily compressed audio
- Recordings with frequent filler sounds or hesitations
- Long gaps or extended silence between sentences, unless you want the cloned voice to reproduce those pauses

<Warning>
  **Your samples define the voice.** The cloned voice will reproduce everything present in your reference audio, including filler sounds like "um", "ah", "hmm", long sentence gaps, breathing patterns, and any other speech habits. If your reference audio contains these sounds or pauses, they will appear in the generated output and cannot be removed after cloning.

  For the most controllable results, use **clean recordings without fillers or long silences**. You can then add natural-sounding hesitations through your text prompts when needed (e.g., writing "um" or "..." in the input text).
</Warning>

## Speaker consent

A voice is cloned only with the speaker's consent. Every request that creates
a voice or adds reference audio to one must state:

> I confirm that I am the speaker of this recording or that I have the
> speaker's permission to create a synthetic voice from it.

In the dashboard this is a checkbox beside your recording. In the API and the
SDKs it is the required field `speaker_consent`, which must be `true`:

- A request without it is rejected with `400` and `error_code`
  `SPEAKER_CONSENT_REQUIRED`. No voice and no audio are stored.
- We record the confirmation with your account, the API key if one was used,
  the voice and the time.
- A voice without a recorded confirmation cannot be published
  (`409`, `SPEAKER_CONSENT_MISSING`). Voices created before this requirement
  have none: add their reference audio again with `speaker_consent` set to
  `true`. They keep working for synthesis.

### Report misuse

If a voice made with KugelAudio impersonates someone, was cloned without the
speaker's consent, or is used for fraud or deception, report it at
[kugelaudio.com/en/report-abuse](/en/report-abuse). Anyone
can report, with or without an account. You get a reference for the report, and
we reply to the email address you give.

<Warning>
  SDK releases up to Python 2.3.0, JavaScript 1.3.0 and Java 3.1.0 do not send
  `speaker_consent`. Their voice-creation and reference-upload calls are
  rejected with `SPEAKER_CONSENT_REQUIRED`; upgrade to the next major release
  and pass the parameter. Synthesis is not affected.
</Warning>

## Creating a Voice Clone

### Via Dashboard

1. Go to **Dashboard** → **Voices** → **Create Voice**
2. Upload your reference audio and confirm the speaker consent
3. Enter a name and description
4. Click **Create Voice**
5. Wait for processing to finish

### Via SDK

Set `supported_languages` to the languages the voice speaks. The first entry
is the voice's primary language: when a synthesis request omits `language`,
it normalizes numbers and dates in text whose language is not recognized
([Text normalization](/features/text-processing)).
It defaults to `["en"]`, so set it for any non-English voice.

<Tabs>
  <Tab title="Python">
    ```python
    from kugelaudio import KugelAudio

    client = KugelAudio(api_key="YOUR_API_KEY")

    # Create a voice with reference audio
    voice = client.voices.create(
        name="My Custom Voice",
        sex="female",
        speaker_consent=True,  # required, see "Speaker consent"
        description="Cloned from reference audio",
        category="conversational",
        supported_languages=["de"],  # first entry = primary language
        reference_files=["reference.wav"],
    )

    print(f"Created voice: {voice.id}")
    print(f"Name: {voice.name}")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    import { KugelAudio } from 'kugelaudio';

    const client = new KugelAudio({ apiKey: 'YOUR_API_KEY' });

    // Create a voice with reference audio (browser)
    const fileInput = document.getElementById('audio-upload') as HTMLInputElement;
    const file = fileInput.files![0];

    const voice = await client.voices.create({
      name: 'My Custom Voice',
      sex: 'female',
      speakerConsent: true, // required, see "Speaker consent"
      description: 'Cloned from reference audio',
      category: 'conversational',
      supportedLanguages: ['de'], // first entry = primary language
      referenceFiles: [file],
    });

    console.log(`Created voice: ${voice.id}`);
    ```
  </Tab>
  <Tab title="cURL">
    ```bash
    curl -X POST https://api.elbic.com/v1/voices \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY" \
      -F 'metadata={"name":"My Custom Voice","sex":"female","description":"Cloned from reference audio","category":"conversational","supported_languages":["de"],"speaker_consent":true};type=application/json' \
      -F "files=@reference.wav"
    ```
  </Tab>
</Tabs>

<Warning>
  Voice creation skips empty, unsupported, or oversized reference files while
  still creating the voice. If you must confirm that a particular file was
  accepted, list the voice's references after creation or add it through the
  dedicated reference-upload endpoint, which returns an error for invalid
  files. See [List references](#list-references).
</Warning>

For Java, see [SDK voices](/sdks/voices?lang=java).

## Using Cloned Voices

Once created, use your cloned voice like any other. The examples continue
from the create step (`voice.id`); in cURL, set `VOICE_ID` to the `id` from
the create response.

<Tabs>
  <Tab title="Python">
    ```python
    # Use your cloned voice
    audio = client.tts.generate(
        text="Hallo, hier spricht meine geklonte Stimme!",
        model_id="kugel-3.5",
        voice_id=voice.id,
        language="de",
    )

    audio.save("cloned_output.wav")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    const audio = await client.tts.generate({
      text: 'Hallo, hier spricht meine geklonte Stimme!',
      modelId: 'kugel-3.5',
      voiceId: voice.id,
      language: 'de',
    });
    ```
  </Tab>
  <Tab title="cURL">
    ```bash
    VOICE_ID=12345  # the id from the create response

    curl -X POST https://api.elbic.com/v1/tts/generate \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "text": "Hallo, hier spricht meine geklonte Stimme!",
        "model_id": "kugel-3.5",
        "voice_id": '"$VOICE_ID"',
        "language": "de"
      }' \
      --output cloned_output.pcm
    ```
  </Tab>
</Tabs>

## Best Practices

### Optimizing Voice Quality

<AccordionGroup>
  <Accordion title="Use high-quality source audio" icon="microphone">
    The quality of your cloned voice depends heavily on the source audio. Use professional recordings when possible.
  </Accordion>
  
  <Accordion title="Provide diverse samples" icon="list">
    Include a range of intonations, emotions, and sentence types in your reference audio for a more natural clone.
  </Accordion>
  
  <Accordion title="Adjust CFG scale" icon="sliders">
    Experiment within the supported `cfg_scale` range of `1.2` to `2.5`.
  </Accordion>
  <Accordion title="Remove filler sounds from samples" icon="eraser">
    If your output contains unwanted "um"s, "ah"s, or hesitations, re-record or edit your reference audio to remove them. The model faithfully reproduces what it hears in the samples: clean input produces clean, controllable output. You can always add fillers via your text prompts later.
  </Accordion>
</AccordionGroup>

### Troubleshooting

| Issue | Solution |
|-------|----------|
| Voice sounds robotic | Use higher quality source audio, try lower CFG scale |
| Voice sounds different | Ensure source audio is clean, try different text samples |
| Accent not preserved | Include more diverse samples, use longer reference audio |
| Inconsistent output | Try a different CFG value within `1.2`–`2.5` |
| Unwanted filler sounds (um, ah, hmm) | Re-record or edit reference audio to remove fillers. See [Content Guidelines](#content-guidelines) |
| Unexpected long pauses | Re-record or edit reference audio to remove long gaps between sentences: the model can learn and reproduce these pauses |

## Managing Cloned Voices

The examples below act on your own voice: `voice.id` from the create step, or
`$VOICE_ID` in cURL.

### List Your Voices

<Tabs>
  <Tab title="Python">
    ```python
    result = client.voices.list()

    for voice in result.voices:
        print(f"{voice.id}: {voice.name}")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    const result = await client.voices.list();

    for (const voice of result.voices) {
      console.log(`${voice.id}: ${voice.name} (${voice.category})`);
    }
    ```
  </Tab>
  <Tab title="cURL">
    ```bash
    curl "https://api.elbic.com/v1/voices" \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY"
    ```
  </Tab>
</Tabs>

### Update Voice

<Tabs>
  <Tab title="Python">
    ```python
    updated = client.voices.update(
        voice_id=voice.id,
        name="Updated Name",
        description="Updated description",
    )
    print(f"Updated: {updated.name}")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    const updated = await client.voices.update(voice.id, {
      name: 'Updated Name',
      description: 'Updated description',
    });
    console.log(`Updated: ${updated.name}`);
    ```
  </Tab>
  <Tab title="cURL">
    ```bash
    curl -X PATCH "https://api.elbic.com/v1/voices/$VOICE_ID" \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Updated Name",
        "description": "Updated description"
      }'
    ```
  </Tab>
</Tabs>

### Delete Voice

<Tabs>
  <Tab title="Python">
    ```python
    client.voices.delete(voice_id=voice.id)
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    await client.voices.delete(voice.id);
    ```
  </Tab>
  <Tab title="cURL">
    ```bash
    curl -X DELETE "https://api.elbic.com/v1/voices/$VOICE_ID" \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY"
    ```
  </Tab>
</Tabs>

## Managing Reference Audio

You can add and remove reference audio files after creating a voice.

### List References

Run this right after creating a voice to confirm which reference files were
accepted.

<Tabs>
  <Tab title="Python">
    ```python
    for ref in client.voices.list_references(voice.id):
        print(f"{ref.id}: {ref.name}")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    const refs = await client.voices.listReferences(voice.id);
    refs.forEach((ref) => console.log(`${ref.id}: ${ref.name}`));
    ```
  </Tab>
  <Tab title="cURL">
    ```bash
    curl "https://api.elbic.com/v1/voices/$VOICE_ID/references" \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY"
    ```
  </Tab>
</Tabs>

### Add Reference

<Tabs>
  <Tab title="Python">
    ```python
    ref = client.voices.add_reference(
        voice_id=voice.id,
        file="new_reference.wav",
        speaker_consent=True,
        reference_text="Optional transcript of the audio.",
    )
    print(f"Added reference: {ref.id}")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    const file = new File([audioBuffer], 'new_reference.wav', { type: 'audio/wav' });
    const ref = await client.voices.addReference(voice.id, file, {
      speakerConsent: true,
      referenceText: 'Optional transcript.',
    });
    console.log(`Added reference: ${ref.id}`);
    ```
  </Tab>
</Tabs>

### Delete Reference

<Tabs>
  <Tab title="Python">
    ```python
    client.voices.delete_reference(voice_id=voice.id, reference_id=ref.id)
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    await client.voices.deleteReference(voice.id, ref.id);
    ```
  </Tab>
</Tabs>

## Publishing Voices

Request that your voice be made public. It will be marked as pending verification until reviewed by an admin.

<Tabs>
  <Tab title="Python">
    ```python
    published = client.voices.publish(voice_id=voice.id)
    print(f"Pending verification: {published.pending_verification}")
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    const published = await client.voices.publish(voice.id);
    console.log(`Pending verification: ${published.pendingVerification}`);
    ```
  </Tab>
</Tabs>

## Generating Voice Samples

Trigger sample audio generation after uploading at least one reference:

```bash
curl -X POST "https://api.elbic.com/v1/voices/$VOICE_ID/generate-sample" \
  -H "Authorization: Bearer $KUGELAUDIO_API_KEY"
```

The response contains `sample_s3_path` and a signed `sample_url`.

## AI Transparency & Watermarking

Voice-cloned output uses the same in-band watermark and HTTP disclosure header
as every other synthesis response. See
[AI-generated audio marking](/api-reference/tts/audio-formats#ai-generated-audio-marking)
for the wire details, detector example, and limitations.

## Privacy & Ethics

<Warning>
  Only clone voices you have permission to use. Misuse of voice cloning technology may violate laws and our Terms of Service.
</Warning>

### Guidelines

1. **Get consent** - Always obtain permission before cloning someone's voice; every clone request records your [speaker consent](#speaker-consent)
2. **Disclose synthetic speech** - Be transparent when using cloned voices in public-facing contexts
3. **No impersonation** - Don't use cloned voices to deceive or defraud
4. **Respect rights** - Don't clone voices of public figures without authorization

## Next Steps

<CardGroup cols={2}>
  <Card
    title="Using Voices"
    icon="microphone"
    href="/features/voices"
  >
    Browse and use available voices
  </Card>
  <Card
    title="Generate Speech"
    icon="play"
    href="/features/generate"
  >
    Generate audio with your cloned voice
  </Card>
  <Card
    title="Models"
    icon="microchip"
    href="/models"
  >
    Learn about available models
  </Card>
</CardGroup>
