An Azure service to easily conduct machine translation with a simple REST API call.
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:
- 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), notspeakTextAsync(...). If you pass SSML into the text call, it never really parses the tags and can appear to “freeze.”
- In the Java Speech SDK you need to call something like
- 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.
- Drop the leading
- Align the language tag and voice.
- You’ve got
xml:lang="zh-CN"but are using an English voice (en-US-SaraNeural). Either switch thexml:langto"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.
- You’ve got
- 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 you’re embedding that snippet directly in a Java
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.