Skip to content

How to reduce http call latency to tts service

szhaomsft edited this page Dec 26, 2019 · 4 revisions

TTS service latency is decided by the synthesis time and network.

For synthesis time, usually the longer text will take longer time to synthesize. Using streaming mode format will be helpful for long text. If you have long text, it is also useful to send the text sentence by sentence to service to reduce latency.

For network latency, HTTP connection usually takes time. When possible, try following steps:

  1. Try to establish connection before posting actual content (using a warm up request).
  2. Reuse the HTTP connection For example, in C#, reuse HttpClient object for each request. Don't create a new one.

Now, it is recommended to use speech SDK to call TTS service. It has a lot of samples in different languages to call TTS from service or client. See more https://github.com/Azure-Samples/cognitive-services-speech-sdk