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

# テキスト読み上げ

> テキスト読み上げ

[XSpeechSynthesizer](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md) API は、音声合成エンジン (音声) を初期化および構成し、テキスト文字列をオーディオ ストリームに変換 (テキスト読み上げ (TTS) とも呼ばれます) するためのサポートを提供します。たとえば、音声の特性、発音、音量、ピッチ、レートまたは速度、強調などは、[Speech Synthesis Markup Language (SSML) バージョン 1.0](https://www.w3.org/TR/speech-synthesis/) を通じてカスタマイズします。

> [!NOTE]
>
> この API では、呼び出し元は SSML のバージョン 1.0 を使用する必要があります。

以下の手順で API を使用します。

1. [XSpeechSynthesizerCreate](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md) を呼び出して音声合成エンジンを作成します。ハンドルは必ず保持しておいてください。
2. [XSpeechSynthesizerSetCustomVoice](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice.md) または
   [XSpeechSynthesizerSetDefaultVoice](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice.md) を呼び出して、使用する音声を選択することもできます。
3. テキストから音声に変換したいテキスト片ごとに、次の手順を使用します。
   1. [XSpeechSynthesizerCreateStreamFromText](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md) を呼び出して新しいストリームを作成します。この関数が完了するまでに、テキストから .wav ファイルへの変換は完了しています。この変換には時間がかかることがあるため、時間的な制約のあるスレッドでは実行しないでください。
   2. [XSpeechSynthesizerGetStreamDataSize](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize.md) を呼び出して、オーディオ データを取得するために必要なバッファーのサイズを決定します。
   3. [XSpeechSynthesizerGetStreamData](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md) を呼び出して、そのストリームからオーディオ データ (.wav ファイル) を取得します。
   4. オーディオ データをオーディオ レンダラーに渡します。
   5. [XSpeechSynthesizerCloseStreamHandle](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md) を呼び出してストリーム ハンドルを閉じます。
4. 音声合成が完全に完了したら、[SpeechSynthesizerCloseHandle](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle.md) を呼び出してハンドルを閉じます。

## リファレンス API ドキュメント

* [Xspeechsynthesizer (API 目次)](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)
  * 関数
    * [XSpeechSynthesizerCreate](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)
    * [XSpeechSynthesizerSetCustomVoice](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice.md)
    * [XSpeechSynthesizerSetDefaultVoice](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice.md)
    * [XSpeechSynthesizerCreateStreamFromText](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md)
    * [XSpeechSynthesizerGetStreamDataSize](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize.md)
    * [XSpeechSynthesizerGetStreamData](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md)
    * [XSpeechSynthesizerCloseStreamHandle](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md)
    * [SpeechSynthesizerCloseHandle](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle.md)

## 関連項目

[XSpeechSynthesizer API リファレンス](https://docs.xbox.com/ja-jp/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)


## Related topics

- [XBOX コンソール向けの GDK 機能](https://docs.xbox.com/ja-jp/build/console-features/console-features-overview.md)
- [Game Chat 2 C++ API の使用](https://docs.xbox.com/ja-jp/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)
- [PlayFab Party テキスト読み上げおよびテキスト入力 UX ガイドライン](https://docs.xbox.com/ja-jp/services/playfab/community/voice-communications/party-text-to-speech-ux-guidelines.md)
- [PartyGender](https://docs.xbox.com/ja-jp/services/playfab/multiplayer/networking/reference/enums/partygender.md)
- [PlayFab Party 音声テキスト変換およびテキスト表示 UX ガイドライン](https://docs.xbox.com/ja-jp/services/playfab/community/voice-communications/party-speech-to-text-ux-guidelines.md)
