> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Démarrage rapide de Voice Design

Ce guide vous explique comment concevoir une voix à partir d’un prompt à l’aide de l’API Voice Design.

## Utiliser l’API Voice Design

> **Note**
>
> Ce guide suppose que vous avez [configuré votre clé API et votre SDK](/docs/fr/eleven-api/quickstart). Terminez
> d’abord le démarrage rapide si ce n’est pas déjà fait. Pour lire l’audio sur vos haut-parleurs, vous aurez peut-être aussi besoin de
> [MPV](https://mpv.io/) et/ou de [ffmpeg](https://ffmpeg.org/).

#### Effectuer la requête API

La conception d’une voix à partir d’un prompt se déroule en deux étapes :

1. Générez des aperçus à partir d’un prompt.
2. Sélectionnez le meilleur aperçu et utilisez-le pour créer une nouvelle voix.

Commencez par générer des aperçus à partir d’un prompt.

Créez un fichier nommé `example.py` ou `example.mts`, selon le langage de votre choix, puis ajoutez le code suivant :

```python maxLines=0
# example.py
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs
from elevenlabs.play import play
import base64

load_dotenv()

elevenlabs = ElevenLabs(
  api_key=os.getenv("ELEVENLABS_API_KEY"),
)

voices = elevenlabs.text_to_voice.design(
    model_id="eleven_multilingual_ttv_v2",
    voice_description="A massive evil ogre speaking at a quick pace. He has a silly and resonant tone.",
    text="Your weapons are but toothpicks to me. Surrender now and I may grant you a swift end. I've toppled kingdoms and devoured armies. What hope do you have against me?",
)

for preview in voices.previews:
    # Convert base64 to audio buffer
    audio_buffer = base64.b64decode(preview.audio_base_64)

    print(f"Playing preview: {preview.generated_voice_id}")

    play(audio_buffer)
```

```typescript maxLines=0
// example.ts
import { ElevenLabsClient, play } from "@elevenlabs/elevenlabs-js";
import "dotenv/config";
import { Readable } from 'node:stream';
import { Buffer } from 'node:buffer';

const elevenlabs = new ElevenLabsClient();

const { previews } = await elevenlabs.textToVoice.design({
    modelId: "eleven_multilingual_ttv_v2",
    voiceDescription: "A massive evil ogre speaking at a quick pace. He has a silly and resonant tone.",
    text: "Your weapons are but toothpicks to me. Surrender now and I may grant you a swift end. I've toppled kingdoms and devoured armies. What hope do you have against me?",
});

for (const preview of previews) {
    // Convert base64 to buffer and create a Readable stream
    const audioStream = Readable.from(Buffer.from(preview.audioBase64, 'base64'));

    console.log(`Playing preview: ${preview.generatedVoiceId}`);

    // Play the audio using the stream
    await play(audioStream);
}
```

#### Exécuter le code

```python
python example.py
```

```typescript
npx tsx example.mts
```

Vous devriez entendre les aperçus des voix générées sur vos haut-parleurs, un à la fois.

#### Ajouter la voix générée à votre bibliothèque

Après avoir généré les aperçus et choisi votre favori, vous pouvez l’ajouter à votre bibliothèque de voix à l’aide de l’ID de voix généré afin de l’utiliser avec d’autres API.

```python
voice = elevenlabs.text_to_voice.create(
    voice_name="Jolly giant",
    voice_description="A huge giant, at least as tall as a building. A deep booming voice, loud and jolly.",
    # The generated voice ID of the preview you want to use,
    # using the first in the list for this example
    generated_voice_id=voices.previews[0].generated_voice_id
)

print(voice.voice_id)
```

```typescript
const voice = await elevenlabs.textToVoice.create({
    voiceName: "Jolly giant",
    voiceDescription: "A huge giant, at least as tall as a building. A deep booming voice, loud and jolly.",
    // The generated voice ID of the preview you want to use,
    // using the first in the list for this example
    generatedVoiceId: previews[0].generatedVoiceId
});

// The ID of the newly created voice, use this to reference the voice in other APIs
console.log(voice.voiceId);
```

## Étapes suivantes

#### [Clonage de voix instantané](/docs/fr/eleven-api/guides/how-to/voices/instant-voice-cloning)

Clonez une voix à partir d’un audio existant plutôt que d’en générer une depuis une description.

#### [Guide de l’API](/docs/fr/api-reference/text-to-voice/design)

Guide et paramètres complets de l’API Voice Design.