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

# XSpeechSynthesizerCreateStreamFromSsml

> XSpeechSynthesizerCreateStreamFromSsml

# XSpeechSynthesizerCreateStreamFromSsml

Creates a speech synthesis stream from the specified SSML.

## Syntax

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

### Parameters

*speechSynthesizer*   \_In\_\
Type: XSpeechSynthesizerHandle

The speech synthesizer to use.

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

The SSML-modified text to speak. For details on the SSML markup, refer to the [W3C recommendations](https://go.microsoft.com/fwlink/p/?LinkID=201763).

<Note>This API requires callers to user version 1.0 of SSML.</Note>

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

A speech synthesis stream that represents the speech generated from the plain text specified in *text*.

### Return value

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

Returns **S\_OK** if successful; otherwise, returns an error code. For a list of error codes, see [Error Codes](/reference/errorcodes). If the function fails because the speech synthesizer stream is larger than the maximum data size, the return value is set to **E\_BOUNDS**.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

* Use this function to synthesize speech from plain text and to generate audio data in the WAVE container (`audio/wav` MIME type) format. After using this function to create a speech synthesizer stream and to synthesize speech from plain text, use the [XSpeechSynthesizerGetStreamDataSize](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdatasize) and [XSpeechSynthesizerGetStreamData](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizergetstreamdata) functions to retrieve the audio data from the speech synthesizer stream. Use the [XSpeechSynthesizerCloseStreamHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle) function to close the speech synthesizer stream after you've retrieved the audio data.

* The maximum data size of a speech synthesizer stream is 0xffffffff bytes: four gigabytes minus one byte. An error occurs if you attempt to create a speech synthesizer stream larger than the maximum data size.

* To prevent memory leaks, call the [XSpeechSynthesizerCloseStreamHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle) function to close a speech synthesizer stream handle after you've completed all operations that are using the handle. All outstanding asynchronous operations must be completed before this function is called.

* For an example that demonstrates how to use the **XSpeechSynthesizerCreateStreamFromSsml** function, see [XSpeechSynthesizerCreate](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizercreate).

## Requirements

**Header:** XSpeechSynthesizer.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[XAccessibility](/reference/system/xaccessibility/xaccessibility_members)\
[XSpeechSynthesizerCloseStreamHandle](/reference/system/xspeechsynthesizer/functions/xspeechsynthesizerclosestreamhandle)\
[XSpeechSynthesizer](/reference/system/xspeechsynthesizer/xspeechsynthesizer_members)
