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

# ボイスリミックスのクイックスタート

このガイドでは、既存の音声をリミックスしてまったく新しい音声を作成する方法を紹介します。

## Voice Design APIの使用

> **Note**
>
> このガイドでは、[APIキーとSDKの設定](/docs/ja/eleven-api/quickstart)が完了していることを前提としています。まだの場合は、まず
> クイックスタートを完了してください。スピーカーからオーディオを再生するには、
> [MPV](https://mpv.io/)や[ffmpeg](https://ffmpeg.org/)も必要になる場合があります。

#### APIリクエストを作成

音声のリミックスは、次の2ステップで行います。

1. 音声IDとプロンプトを指定して、新しい音声のプレビューを生成します。
2. プレビューから新しい音声を作成します。

まず、新しい音声のプレビューを生成します。

使用する言語に応じて、`example.py`または`example.mts`という新しいファイルを作成し、次のコードを追加します。

> **Warning**
>
> リミックスできるのは、以前にデザインした音声、IVCまたはPVCの音声、無期限の通知期間が設定されたボイスライブラリ内の音声のみです。

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

#### コードを実行

```python
python example.py
```

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

生成された音声プレビューが、1つずつスピーカーから再生されます。

#### 生成した音声をライブラリに追加

プレビューを生成してお気に入りを選んだら、生成された音声IDを使ってボイスライブラリに追加できます。これにより、他のAPIでも使用できるようになります。

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

## 次のステップ

#### [ボイスデザイン](/docs/ja/eleven-api/guides/how-to/voices/voice-design)

既存の音声をリミックスする代わりに、テキストによる説明から新しい音声を生成します。

#### [APIリファレンス](/docs/ja/api-reference/text-to-voice/remix)

Voice Remix APIの完全なリファレンスとパラメータ。