When calling speak_ssml_async (in Speech Services, using Python), keep getting Error decoding audio stream, error code: -50

Bing Wu at Work 0 Reputation points
2023-11-19T01:30:21.64+00:00

I am a beginner trying out the Azure Speech Services' Text to Speech or Synthesized Speech feature.

I followed the QuickStart and other related code samples, also used samples generated from Azure Speech Studio. In other words, I tried multiple versions that comes with the Service tutorial (see code sample at the end)

However, when I ran my code, I keep getting this error:

Speech synthesis canceled: CancellationReason.Error

Error details: Error decoding audio stream, error code: -50

Anyone else's seen this behavior/problem? Any pointers where I should start looking?

Thanks!

Bing

if __name__ == '__main__':
    '''
      For more samples please visit https://github.com/Azure-Samples/cognitive-services-speech-sdk 
    '''

    import azure.cognitiveservices.speech as speechsdk

    # Creates an instance of a speech config with specified subscription key and service region.
    speech_key = "copy-pasted-from-console"
    service_region = "eastus"

    speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
    # Note: the voice setting will not overwrite the voice element in input SSML.
    speech_config.speech_synthesis_voice_name = "en-US-JennyMultilingualNeural"

    text = "Hi, this is Jenny Multilingual"

    # use the default speaker as audio output.
    speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)

    result = speech_synthesizer.speak_text_async(text).get()
    # Check result
    if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
        print("Speech synthesized for text [{}]".format(text))
    elif result.reason == speechsdk.ResultReason.Canceled:
        cancellation_details = result.cancellation_details
        print("Speech synthesis canceled: {}".format(cancellation_details.reason))
        if cancellation_details.reason == speechsdk.CancellationReason.Error:
            print("Error details: {}".format(cancellation_details.error_details))

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,732 questions
{count} votes

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.