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

# テキスト読み上げ

> テキスト読み上げ

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

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

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

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

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

* [Xspeechsynthesizer (API 目次)](/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)
  * 関数
    * [XSpeechSynthesizerCreate](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate)
    * [XSpeechSynthesizerSetCustomVoice](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice)
    * [XSpeechSynthesizerSetDefaultVoice](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice)
    * [XSpeechSynthesizerCreateStreamFromText](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext)
    * [XSpeechSynthesizerGetStreamDataSize](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize)
    * [XSpeechSynthesizerGetStreamData](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata)
    * [XSpeechSynthesizerCloseStreamHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle)
    * [SpeechSynthesizerCloseHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle)

## 関連項目

[XSpeechSynthesizer API リファレンス](/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)


## Related topics

- [コンソール固有の GDK 機能](/ja-jp/build/console-features/console-features-overview.md)
- [Game Chat 2 C++ API の使用](/ja-jp/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)
- [PlayFab Party テキスト読み上げおよびテキスト入力 UX ガイドライン](/ja-jp/services/playfab/community/voice-communications/party-text-to-speech-ux-guidelines.md)
- [XAG 119: 音声認識およびテキスト読み上げチャット](/ja-jp/build/game-principles/accessibility/xag-deep-dives/xag-119-chat.md)
- [PlayFab Party 音声認識およびテキスト表示 UX ガイドライン](/ja-jp/services/playfab/community/voice-communications/party-speech-to-text-ux-guidelines.md)
