The following content causes the call to hang when invoked through the Java SDK.

先生 王 0 Reputation points
2026-05-08T10:53:47.4733333+00:00
<?xml version="1.0" encoding="UTF-8"?><speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" version="1.0" xml:lang="zh-CN"><voice name="en-US-SaraNeural"><prosody rate="-10%">Kipper set them free. 
"Come on, everyone," said Robin Hood. "Let's go back to the woods. 
We don't want the Sheriff to catch us."
They went to a new part of the woods. 
"Three cheers for Kipper," said Robin Hood. 
"Now let's sing that song about me again." 
"Oh no!" said Kipper.</prosody></voice></speak>

Azure Translator in Foundry Tools
0 comments No comments

2 answers

Sort by: Most helpful
  1. Thanmayi Godithi 11,555 Reputation points Microsoft External Staff Moderator
    2026-05-31T06:43:45.32+00:00

    Hey there! It sounds like you’ve got a block of SSML that works elsewhere but literally hangs when you feed it through the Java TTS SDK. A few things to double-check:

    1. Make sure you’re actually invoking the SSML-aware API and not the plain-text method.
      • In the Java Speech SDK you need to call something like synthesizer.SpeakSsmlAsync(ssml) (or the equivalent speakSsml method), not speakTextAsync(...). If you pass SSML into the text call, it never really parses the tags and can appear to “freeze.”
    2. Remove the XML declaration header.
      • Drop the leading <?xml version="1.0" encoding="UTF-8"?> line and just start your string with <speak …>. The Java SDK’s SSML parser expects the <speak> element as the root.
    3. Align the language tag and voice.
      • You’ve got xml:lang="zh-CN" but are using an English voice (en-US-SaraNeural). Either switch the xml:lang to "en-US" or pick a Mandarin voice (e.g. zh-CN-XiaoxiaoNeural). Mismatches here sometimes cause the service to hang waiting for the “right” model.
    4. Escape or remove inline quotes in your Java string.
      • If you’re embedding that snippet directly in a Java String, every " inside your XML must be \". A malformed string can compile but send bad SSML, which can also stall the synth.

    If it still hangs after those tweaks, could you share a bit more?

    • The exact Java SDK version you’re on

    • The code snippet you’re using to call the service (particularly which “speak…” method)

    • Any logs or exceptions you see when you turn on DEBUG/TRACE for the speech library

    That extra info will help narrow down whether it’s an SDK-side parser issue, a service bug, or just a small SSML mismatch.

    Was this answer helpful?

    0 comments No comments

  2. 先生 王 0 Reputation points
    2026-05-08T10:56:30.2633333+00:00

    Change the "zh-CN" to "en-US" not work.

    Was this answer helpful?

    0 comments No comments

Your answer

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