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

Crée un flux de synthèse vocale à partir du texte brut spécifié.

## Syntaxe

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

### Paramètres

*speechSynthesizer*   \_In\_\
Type : XSpeechSynthesizerHandle

Le synthétiseur vocal à utiliser.

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

Le texte brut à partir duquel générer la parole.

*speechSynthesisStream*   \_Out\_\
Type : XSpeechSynthesizerStreamHandle\*

Un flux de synthèse vocale qui représente la parole générée à partir du texte brut spécifié dans *text*.

### Valeur de retour

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

Retourne **S\_OK** en cas de réussite; sinon, retourne un code d'erreur. Pour obtenir la liste des codes d'erreur, consultez [Codes d'erreur](/fr-CA/reference/errorcodes). Si la fonction échoue parce que le flux du synthétiseur vocal dépasse la taille de données maximale, la valeur de retour est **E\_BOUNDS**.

## Remarques

<Note>Il n'est pas sécuritaire d'appeler cette fonction sur un thread sensible au temps. Pour plus d'informations, consultez [Threads sensibles au temps](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

* Utilisez cette fonction pour synthétiser la parole à partir de texte brut et générer des données audio au format de conteneur WAVE (type MIME `audio/wav`). Après avoir utilisé cette fonction pour créer un flux de synthétiseur vocal et synthétiser la parole à partir de texte brut, utilisez les fonctions [XSpeechSynthesizerGetStreamDataSize](/fr-CA/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize) et [XSpeechSynthesizerGetStreamData](/fr-CA/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata) pour récupérer les données audio du flux du synthétiseur vocal. Utilisez la fonction [XSpeechSynthesizerCloseStreamHandle](/fr-CA/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle) pour fermer le flux du synthétiseur vocal une fois les données audio récupérées.

* La taille de données maximale d'un flux de synthétiseur vocal est de 0xffffffff octets, soit quatre gigaoctets moins un octet. Une erreur se produit si vous tentez de créer un flux de synthétiseur vocal plus grand que la taille de données maximale.

* Pour éviter les fuites de mémoire, appelez la fonction [XSpeechSynthesizerCloseStreamHandle](/fr-CA/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle) pour fermer un handle de flux de synthétiseur vocal une fois que vous avez terminé toutes les opérations qui utilisent ce handle. Toutes les opérations asynchrones en attente doivent être terminées avant l'appel de cette fonction.

* Pour un exemple montrant comment utiliser la fonction **XSpeechSynthesizerCreateStreamFromText**, consultez [XSpeechSynthesizerCreate](/fr-CA/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate).

## Configuration requise

**En-tête :** XSpeechSynthesizer.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Documentation conceptuelle

* [Synthèse vocale](/fr-CA/build/console-features/text-to-speech/text-to-speech)
* [Threads sensibles au temps](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Voir aussi

[XAccessibility](/fr-CA/reference/system/xaccessibility/xaccessibility_members)\
[XSpeechSynthesizerCloseStreamHandle](/fr-CA/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle)\
[XSpeechSynthesizer](/fr-CA/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)
