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

400 error #87

Closed
mm3509 opened this issue Apr 14, 2024 · 3 comments
Closed

400 error #87

mm3509 opened this issue Apr 14, 2024 · 3 comments
Labels
invalid This doesn't seem right question Further information is requested wontfix This will not be worked on

Comments

@mm3509
Copy link

mm3509 commented Apr 14, 2024

I've been using the Python SDK, but due to Azure-Samples/cognitive-services-speech-sdk#2204 and Azure-Samples/cognitive-services-speech-sdk#2048, I am moving to REST.

I installed aspeak and tried the sample code, e.g.:

        service = aspeak.SpeechService(
            region=SPEECH_REGION,
            key=get_key()
        )
        print(ssml)
        service.speak_ssml(ssml)

I get this error:

$ python3 tts_microsoft.py
<speak>Olá crianças! Como se sentem? Eu sinto-me contente.</speak>
Traceback (most recent call last):
  File "~/tts_microsoft.py", line 150, in synth
    service.speak_ssml(ssml)
OSError: unified synthesizer error: an invalid request is constructed or 400 status reported by the server

Caused by:
   0: rest synthesizer error: an invalid request is constructed or 400 status reported by the server
   1: HTTP status client error (400 Bad Request) for url (https://westeurope.tts.speech.microsoft.com/cognitiveservices/v1)

Location:
    src/synthesizer/unified.rs:60:62

I get the same error if I use .synthesize_ssml, with or without the output argument.

How can I fix this error and run Microsoft's text-to-speech with aspeak and REST?

@kxxt
Copy link
Owner

kxxt commented Apr 14, 2024

400 error indicates your ssml is not valid. Please read the Microsoft documentation about how to construct SSML: https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-synthesis-markup-structure

@kxxt kxxt closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2024
@kxxt kxxt added invalid This doesn't seem right question Further information is requested wontfix This will not be worked on labels Apr 14, 2024
@mm3509
Copy link
Author

mm3509 commented Apr 14, 2024

Correct! Once I fixed the SSML to Microsoft's standards, instead of generic SSML, it worked. Thanks! For reference, this SSML failed:

<speak>Olá crianças! Como se sentem? Eu sinto-me contente.</speak>

This SSML worked:

<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='https://www.w3.org/2001/mstts' xml:lang='pt-pt'><voice name='pt-PT-RaquelNeural'>Olá crianças! Como se sentem? Eu sinto-me contente.</voice></speak>

@mm3509
Copy link
Author

mm3509 commented Apr 14, 2024

I found this package by chance. I was using the official Python SDK, but out of nowhere it started failing with an OpenSSL issue unsolved for 8 months, also referenced here. The first issue suggests:

I think at this point your best bet is trying to migrate to the Azure Cognitive Services REST API, as Microsoft clearly has no interest or resources in maintaining the native SDK anymore.

I hope this helps someone find this package too. Thanks @kxxt for sharing this great piece of work and making my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants