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

> XSpeechSynthesizer

# XSpeechSynthesizer

提供对初始化和配置语音合成引擎（即*语音*）的支持，用于将文本字符串转换为音频流。此功能也称为文本转语音 (TTS)。

## 函数

| 函数                                                                                                                                      | 说明                                                                                                                                                               |
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [XSpeechSynthesizerCloseHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle)                           | 关闭语音合成器并释放已分配的系统资源。                                                                                                                                              |
| [XSpeechSynthesizerCloseStreamHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle)               | 关闭语音合成器流并释放已分配的系统资源。                                                                                                                                             |
| [XSpeechSynthesizerCreate](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate)                                     | 创建语音合成器。                                                                                                                                                         |
| [XSpeechSynthesizerCreateStreamFromSsml](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromssml)         | 从指定的 SSML 创建语音合成流。                                                                                                                                               |
| [XSpeechSynthesizerCreateStreamFromText](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext)         | 从指定的纯文本创建语音合成流。                                                                                                                                                  |
| [XSpeechSynthesizerEnumerateInstalledVoices](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices) | 枚举已安装的语音，并针对每个语音调用由 *callback* 指向的方法。                                                                                                                            |
| [XSpeechSynthesizerGetStreamData](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata)                       | 从语音合成流中检索数据。                                                                                                                                                     |
| [XSpeechSynthesizerGetStreamDataSize](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize)               | 获取语音合成流的数据缓冲区的大小。                                                                                                                                                |
| [XSpeechSynthesizerInstalledVoicesCallback](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerinstalledvoicescallback)   | 在调用 [XSpeechSynthesizerEnumerateInstalledVoices](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerenumerateinstalledvoices) 时接收有关语音信息的客户端实现回调函数。 |
| [XSpeechSynthesizerSetCustomVoice](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice)                     | 指定语音合成器将使用指定的自定义语音。                                                                                                                                              |
| [XSpeechSynthesizerSetDefaultVoice](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice)                   | 指定语音合成器将使用系统默认语音。                                                                                                                                                |

## 结构

| 结构                                                                                                                    | 说明         |
| --------------------------------------------------------------------------------------------------------------------- | ---------- |
| [XSpeechSynthesizerVoiceInformation](/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation) | 提供有关语音的信息。 |

## 枚举

| 枚举                                                                                                        | 说明       |
| --------------------------------------------------------------------------------------------------------- | -------- |
| [XSpeechSynthesizerVoiceGender](/reference/system/xspeechsynthesizer/enums/xspeechsynthesizervoicegender) | 指示语音的性别。 |

## 概念文档

* [文本转语音](/build/console-features/text-to-speech/text-to-speech)
* [时间敏感型线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)
* [在 Unity 项目中使用 GDK API 的 C# 包装器](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/get-started-with-unity-pc/features/gdk-unity-api-wrappers)

## 另请参阅

[系统 API 参考](/reference/system/gc-reference-system-toc)


## Related topics

- [XSpeechSynthesizerCreate](/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)
- [XSpeechSynthesizerVoiceGender](/zh-CN/reference/system/xspeechsynthesizer/enums/xspeechsynthesizervoicegender.md)
- [XSpeechSynthesizerCloseHandle](/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosehandle.md)
- [XSpeechSynthesizerVoiceInformation](/zh-CN/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md)
- [XSpeechSynthesizerCloseStreamHandle](/zh-CN/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md)
