Text to Speech, Speech Synthesize, Speech Services, QuickStart program,Error decoding audio stream, error code: -50

Bing Wu at Work 0 Reputation points
2023-11-19T01:31:53.1366667+00:00

I am new to Speech Services. So I copied a Python program from the QuickStart guide, and tried similar versions from Speech Studio's Voice Catalog, and API reference.

However, this simple program keeps giving me a very cryptic error :

Speech synthesis canceled: CancellationReason.Error

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

I don't use anything that involves decoding an audio stream. I wonder why I am getting this error?

My service plan is a paid tier, and I have given myself all the roles I can think of (starting with Owner)

None changed anything.

Please help,

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,853 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,185 Reputation points Microsoft Employee
    2023-11-22T07:39:07.27+00:00

    @Bing Wu at Work I'm glad to see you were able to resolve your issue. Thanks for posting your solution so that others experiencing the same thing can easily reference this. Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer. So that it benefits our community audience who encounter the same issue.
    .
    Issue:
    You are encountering an error while trying to use the Speech Services QuickStart program. They are getting an error message that says Speech synthesis canceled: CancellationReason.Error Error details: Error decoding audio stream, error code: -50.
    .
    Resolution:
    You followed the below steps and got it to work:

    1. Saving the output to a file vs directing to speaker
    2. Making an explicit Config call to save as a MP3

    Among the above 2 you feel that the 2nd option might have helped.
    .
    Regarding the feedback you had shared, I would recommend you to share these feedback in the feedback forum: https://feedback.azure.com/d365community/forum/09041fae-0b25-ec11-b6e6-000d3a4f0858
    .
    So that our Product Group team can look into it and share their thoughts.

    0 comments No comments

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.