Skip to content

Commit 427279f

Browse files
Update how-to-lower-speech-synthesis-latency.md
1 parent 2103c79 commit 427279f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

articles/ai-services/speech-service/how-to-lower-speech-synthesis-latency.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,28 @@ For Android, iOS and macOS, no extra configuration is needed starting version 1.
320320
321321
## Text streaming
322322
323-
The text stream API allows real-time text processing for rapid audio generation. It's perfect for dynamic text vocalization, such as reading outputs from AI models like GPT in real-time. This API minimizes latency and improves the fluidity and responsiveness of audio outputs, making it ideal for interactive applications, live events, and responsive AI-driven dialogues.
323+
Text streaming allows real-time text processing for rapid audio generation. It's perfect for dynamic text vocalization, such as reading outputs from AI models like GPT in real-time. This feature minimizes latency and improves the fluidity and responsiveness of audio outputs, making it ideal for interactive applications, live events, and responsive AI-driven dialogues.
324324
325-
### How to use the text stream API
325+
### How to use text streaming
326326
327-
To use the text stream API, connect to the websocket V2 endpoint: `wss://{region}.tts.speech.microsoft.com/cognitiveservices/websocket/v2`
327+
To use the text streaming feature, connect to the websocket V2 endpoint: `wss://{region}.tts.speech.microsoft.com/cognitiveservices/websocket/v2`
328328
329329
::: zone pivot="programming-language-csharp"
330330
331+
See the sample code for setting the endpoint:
332+
333+
```csharp
334+
// IMPORTANT: MUST use the websocket v2 endpoint
335+
var ttsEndpoint = $"wss://{Environment.GetEnvironmentVariable("AZURE_TTS_REGION")}.tts.speech.microsoft.com/cognitiveservices/websocket/v2";
336+
var speechConfig = SpeechConfig.FromEndpoint(
337+
new Uri(ttsEndpoint),
338+
Environment.GetEnvironmentVariable("AZURE_TTS_API_KEY"));
339+
```
340+
331341
#### Key steps
332342

333343
1. **Create a text stream request**: Use `SpeechSynthesisRequestInputType.TextStream` to initiate a text stream.
334-
1. **Set global properties**: Adjust settings such as output format and voice name directly, as the API handles partial text inputs and doesn't support SSML. Refer to the following sample code for instructions on how to set them.
344+
1. **Set global properties**: Adjust settings such as output format and voice name directly, as the feature handles partial text inputs and doesn't support SSML. Refer to the following sample code for instructions on how to set them.
335345

336346
```csharp
337347
// Set output format

0 commit comments

Comments
 (0)