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

# Guia de início rápido de remixagem de voz

Este guia mostra como criar uma voz totalmente nova remixando uma voz existente.

## Usando a API Voice Design

> **Note**
>
> Este guia pressupõe que você já [configurou sua chave de API e seu SDK](/docs/pt/eleven-api/quickstart). Conclua
> primeiro o guia de início rápido, caso ainda não tenha feito isso. Para reproduzir áudio pelos alto-falantes, talvez você também precise de
> [MPV](https://mpv.io/) e/ou [ffmpeg](https://ffmpeg.org/).

#### Faça a solicitação à API

Remixar uma voz é um processo de duas etapas:

1. Gere uma prévia da nova voz informando um ID de voz e um prompt.
2. Crie a nova voz a partir da prévia.

Vamos começar gerando uma prévia da nova voz.

Crie um novo arquivo chamado `example.py` ou `example.mts`, dependendo da linguagem escolhida, e adicione o código a seguir:

> **Warning**
>
> Você só pode remixar vozes criadas anteriormente, vozes IVC ou PVC e vozes da Voice Library que tenham períodos de aviso infinitos.

```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.remix(
    voice_id="JBFqnCBsd6RMkjVDRZzb"
    voice_description="Use a higher pitch and change to a Boston accent.",
    text="Of course I'm a Bostonian, I've lived here all my life!",
)

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.remix("JBFqnCBsd6RMkjVDRZzb", {
    voiceDescription: "Use a higher pitch and change to a Boston accent.",
    text: "Of course I'm a Bostonian, I've lived here all my life!",
});

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

#### Execute o código

```python
python example.py
```

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

Você deverá ouvir as prévias de voz geradas sendo reproduzidas pelos alto-falantes, uma por vez.

#### Adicione a voz gerada à sua biblioteca

Depois de gerar as prévias e escolher sua favorita, você pode adicioná-la à sua biblioteca de vozes usando o ID da voz gerada, para utilizá-la com outras APIs.

```python
voice = elevenlabs.text_to_voice.create(
    voice_name="Bostonian",
    voice_description="A high pitched Bostonian accent.",
    # 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: "Bostonian",
    voiceDescription: "A high pitched Bostonian accent.",
    // 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);
```

## Próximas etapas

#### [Design de voz](/docs/pt/eleven-api/guides/how-to/voices/voice-design)

Gere uma nova voz a partir de uma descrição em texto, em vez de remixar uma existente.

#### [Referência da API](/docs/pt/api-reference/text-to-voice/remix)

Referência e parâmetros completos da API Voice Remix.