How do I extend the waiting time of Azure speech-to-text API in Python?

Muyao Hu 26 Reputation points
2022-04-04T15:54:04.937+00:00

When using speech-to-text to transfer audio file to text, I found that the function would stop working if human voices haven't occurred for about 5 seconds. In my case, what I want to transfer is audios of interviews, which would often contain some advertisements or music in the middle of it, and when this happens, the speech-to-text would only transfer the first half of the whole audio, and report an error that "No speech could be recognized".
In this case, how can I extend the waiting time of that in order to transfer the whole file in Python codes?

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,069 questions
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,340 questions
{count} votes

Accepted answer
  1. YutongTie-MSFT 53,971 Reputation points Moderator
    2022-04-06T00:32:24.237+00:00

    Hello @Muyao Hu

    I think there are two solutions you can have a try in Python SDK:

    1. There is a 'set_property' method on the config to allow you to set parameters to your request, which can change the default silence time:: https://learn.microsoft.com/en-us/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.propertycollection?view=azure-python#azure-cognitiveservices-speech-propertycollection-set-property
    2. This way you can set the EndSilenceTimeout (PropertyIDs in Pyhton: https://learn.microsoft.com/en-us/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.propertyid?view=azure-python#fields)

    Please notice, the time is as "ms". Hope above helps!

    Regards,
    Yutong

    -Please kindly accept the answer if you feel helpful, thanks!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.