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

# XSpeechSynthesizerCreateStreamFromText

> XSpeechSynthesizerCreateStreamFromText

# XSpeechSynthesizerCreateStreamFromText

Cria um fluxo de síntese de fala a partir do texto sem formatação especificado.

## Sintaxe

```cpp theme={null}
HRESULT XSpeechSynthesizerCreateStreamFromText(  
         XSpeechSynthesizerHandle speechSynthesizer,  
         const char* text,  
         XSpeechSynthesizerStreamHandle* speechSynthesisStream  
)  
```

### Parâmetros

*speechSynthesizer*   \_In\_\
Tipo: XSpeechSynthesizerHandle

O sintetizador de fala a ser usado.

*text*   \_In\_z\_\
Tipo: char\*

O texto sem formatação a partir do qual gerar a fala.

*speechSynthesisStream*   \_Out\_\
Tipo: XSpeechSynthesizerStreamHandle\*

Um fluxo de síntese de fala que representa a fala gerada a partir do texto sem formatação especificado em *text*.

### Valor retornado

Tipo: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

Retorna **S\_OK** se for bem-sucedida; caso contrário, retorna um código de erro. Para obter uma lista de códigos de erro, consulte [Códigos de erro](https://docs.xbox.com/pt-BR/reference/errorcodes.md). Se a função falhar porque o fluxo do sintetizador de fala é maior que o tamanho máximo de dados, o valor retornado será definido como **E\_BOUNDS**.

## Comentários

> [!NOTE]
>
> Não é seguro chamar esta função em um thread sensível ao tempo. Para obter mais informações, consulte [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).

* Use esta função para sintetizar fala a partir de texto sem formatação e gerar dados de áudio no formato de contêiner WAVE (tipo MIME `audio/wav`). Depois de usar esta função para criar um fluxo do sintetizador de fala e sintetizar fala a partir de texto sem formatação, use as funções [XSpeechSynthesizerGetStreamDataSize](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize.md) e [XSpeechSynthesizerGetStreamData](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata.md) para recuperar os dados de áudio do fluxo do sintetizador de fala. Use a função [XSpeechSynthesizerCloseStreamHandle](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md) para fechar o fluxo do sintetizador de fala depois de recuperar os dados de áudio.

* O tamanho máximo de dados de um fluxo do sintetizador de fala é 0xffffffff bytes: quatro gigabytes menos um byte. Ocorrerá um erro se você tentar criar um fluxo do sintetizador de fala maior que o tamanho máximo de dados.

* Para evitar vazamentos de memória, chame a função [XSpeechSynthesizerCloseStreamHandle](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md) para fechar um identificador de fluxo do sintetizador de fala depois de concluir todas as operações que estão usando o identificador. Todas as operações assíncronas pendentes devem ser concluídas antes que esta função seja chamada.

* Para obter um exemplo que demonstra como usar a função **XSpeechSynthesizerCreateStreamFromText**, consulte [XSpeechSynthesizerCreate](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md).

## Requisitos

**Cabeçalho:** XSpeechSynthesizer.h

**Biblioteca:** xgameruntime.lib

**Plataformas com suporte:** Windows, consoles da família XBOX One e consoles XBOX Series

## Documentação conceitual

* [Conversão de texto em fala](https://docs.xbox.com/pt-BR/build/console-features/text-to-speech/text-to-speech.md)
* [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Confira também

[XAccessibility](https://docs.xbox.com/pt-BR/reference/system/xaccessibility/xaccessibility_members.md)\
[XSpeechSynthesizerCloseStreamHandle](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle.md)\
[XSpeechSynthesizer](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)


## Related topics

- [XSpeechSynthesizerGetStreamDataSize](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize.md)
- [XSpeechSynthesizerVoiceInformation](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/structs/xspeechsynthesizervoiceinformation.md)
- [XSpeechSynthesizerSetCustomVoice](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetcustomvoice.md)
- [XSpeechSynthesizerSetDefaultVoice](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizersetdefaultvoice.md)
- [XSpeechSynthesizerCreate](https://docs.xbox.com/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)
