Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set SpeechSynthesizer timeout? #2679

Open
valerauko opened this issue Nov 28, 2024 · 4 comments
Open

How to set SpeechSynthesizer timeout? #2679

valerauko opened this issue Nov 28, 2024 · 4 comments
Labels
update needed For items that are in progress but have not been updated

Comments

@valerauko
Copy link

Occasionally I observe the following error: CancellationErrorCode "ServiceTimeout" with message "USP error: timeout waiting for the first audio chunk" after roughly 40 seconds.

While this is unfortunate, my question is really how do I set a shorter timeout on the client side? When it doesn't time out, even if it's slow it's a few seconds at worst (and obviously much less until the "first audio chunk").

So I'd like to set a timeout much shorter than the observed 40sec and fail quick (and potentially retry)

Looking at the docs for SpeechSynthesizer and SpeechConfig I couldn't find any way so far.

Env

Java 21 with eclipse-temurin:21-jre-noble
SDK version com.microsoft.cognitiveservices.speech client-sdk 1.41.1

@BrianMouncer
Copy link
Contributor

I'm not sure any of the TTS timeout values will help in this case.
You might want to try using pre-connect, so you can connect before actually needing the connection, as well as possibly handling any retry attempts.

This will also speed up the first audio chunk latency, because the network initialization and web socket upgrade will have already been done.

@valerauko
Copy link
Author

Is the ServiceTimeout a connection timeout? I had the impression that it's timing out waiting for the model to generate the sound, not the network (it tends to happen with some models way more often than others)

@jamesw966
Copy link

I also hit this issue today and I'd like the ability to fail much faster (a few seconds if possible as I have a conversational AI use case). Python 3.12.7, SDK 1.41.1.

Copy link

github-actions bot commented Jan 7, 2025

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

@github-actions github-actions bot added the update needed For items that are in progress but have not been updated label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
update needed For items that are in progress but have not been updated
Projects
None yet
Development

No branches or pull requests

3 participants