> 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.

# Szybki start z Voice Design

Ten przewodnik pokaże ci, jak zaprojektować głos za pomocą promptu w Voice Design API.

## Korzystanie z Voice Design API

> **Note**
>
> Ten przewodnik zakłada, że [masz już skonfigurowany klucz API i SDK](/docs/pl/eleven-api/quickstart). Jeśli jeszcze tego nie zrobiłeś,
> najpierw ukończ przewodnik szybkiego startu. Aby odtwarzać dźwięk przez głośniki, możesz też potrzebować
> [MPV](https://mpv.io/) i/lub [ffmpeg](https://ffmpeg.org/).

#### Wyślij żądanie API

Projektowanie głosu za pomocą promptu ma dwa etapy:

1. Wygeneruj podglądy na podstawie promptu.
2. Wybierz najlepszy podgląd i użyj go do utworzenia nowego głosu.

Zacznijmy od wygenerowania podglądów na podstawie promptu.

Utwórz nowy plik o nazwie `example.py` lub `example.mts`, zależnie od wybranego języka, i dodaj poniższy kod:

```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);
}
```

#### Uruchom kod

```python
python example.py
```

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

Powinieneś usłyszeć podglądy wygenerowanych głosów odtwarzane kolejno przez głośniki.

#### Dodaj wygenerowany głos do biblioteki

Gdy wygenerujesz podglądy i wybierzesz ulubiony, możesz dodać go do biblioteki głosów przez identyfikator wygenerowanego głosu, aby używać go z innymi 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);
```

## Kolejne kroki

#### [Klonowanie głosu Instant](/docs/pl/eleven-api/guides/how-to/voices/instant-voice-cloning)

Sklonuj głos z istniejącego nagrania zamiast generować go z opisu.

#### [Dokumentacja API](/docs/pl/api-reference/text-to-voice/design)

Pełna dokumentacja Voice Design API i parametry.