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

# 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](/pt-BR/reference/errorcodes). 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).</Note>

* 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](/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize) e [XSpeechSynthesizerGetStreamData](/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata) para recuperar os dados de áudio do fluxo do sintetizador de fala. Use a função [XSpeechSynthesizerCloseStreamHandle](/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle) 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](/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle) 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](/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate).

## 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](/pt-BR/build/console-features/text-to-speech/text-to-speech)
* [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](/pt-BR/reference/system/xaccessibility/xaccessibility_members)\
[XSpeechSynthesizerCloseStreamHandle](/pt-BR/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle)\
[XSpeechSynthesizer](/pt-BR/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)


## Related topics

- [XSpeechSynthesizerCreateStreamFromText](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreatestreamfromtext.md)
- [Text-to-speech](/build/console-features/text-to-speech/text-to-speech.md)
- [XSpeechSynthesizerCreate](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate.md)
- [XSpeechSynthesizer](/reference/system/xspeechsynthesizer/xspeechsynthesizer_members.md)
- [XSpeechSynthesizerGetStreamDataSize](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize.md)
