Cognitive-Speech-TTS icon indicating copy to clipboard operation
Cognitive-Speech-TTS copied to clipboard

How to make it read accented characters in Spanish?

Open Jun711 opened this issue 2 years ago • 2 comments

It doesn't seem to be able to read words with accented characters when I send the request using the API endpoint.

However, it works when I use the sdk which uses wss but I don't plan to switch to that at the moment as it requires me to re-configure my server using docker.

I have checked the document on Azure website but there is no example for that.

This is what I used to send the TTS request.

test = "<speak version='1.0' xml:lang='en-us'><voice xml:lang='es-US' xml:gender='Male' name='es-US-AlonsoNeural'><prosody rate="0%">típico de los años</prosody></voice></speak>"
headers = {"Content-type" : "application/ssml+xml",
      "X-Microsoft-OutputFormat" : "riff-24khz-16bit-mono-pcm",
      "Authorization" : "Bearer " + auth_token,
      "Content-length":str(len(text))
  }
res = requests.post("https://westus2.tts.speech.microsoft.com/cognitiveservices/v1", data=text , headers=headers, timeout=29)

Thank you

Jun711 avatar Apr 04 '22 21:04 Jun711

is it encoding issue? https://stackoverflow.com/questions/708915/detecting-the-character-encoding-of-an-http-post-request

szhaomsft avatar Apr 16 '22 02:04 szhaomsft

@szhaomsft I tried adding charset=UTF-8 but it still doesn't work. These are the headers that I used

headers = {"Content-type" : "application/ssml+xml; charset=UTF-8",
            "X-Microsoft-OutputFormat" : "riff-24khz-16bit-mono-pcm", 
            "Authorization" : "Bearer " + auth_token,
            "Content-length" : str(len(text))
        }

Jun711 avatar Apr 19 '22 21:04 Jun711