Android TTS 支持语音合成标记语言吗?
将以下 SSML(语音合成标记语言)文档传递到 com.svox.pico TextToSpeech 引擎导致读取 XML 正文,但无法控制音素元素或强调元素。此结果(没有明显的 SSML 控制)在运行 Android 2.2 的 Nexus One 以及运行 SDK 级别 8 的 AVD 的模拟器上是相同的。
String text = "<?xml version=\"1.0\"?>" +
"<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
"xsi:schemaLocation=\"http://www.w3.org/2001/10/synthesis " +
"http://www.w3.org/TR/speech-synthesis/synthesis.xsd\" " +
"xml:lang=\"en-US\">" +
"tomato " +
"<phoneme alphabet=\"ipa\" ph=\"t&#x259;mei&#x325;&#x27E;ou&#x325;\"> tomato </phoneme> " +
"That is a big car! " +
"That <emphasis> is </emphasis> a big car! " +
"That is a <emphasis> big </emphasis> car! " +
"That is a huge bank account! " +
"That <emphasis level=\"strong\"> is </emphasis> a huge bank account! " +
"That is a <emphasis level=\"strong\"> huge </emphasis> bank account!" +
"</speak>";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);
是否有任何 Android TTS 引擎支持任何 SSML 元素?
Passing the following SSML (Speech Synthesis Markup Language) document to the com.svox.pico TextToSpeech engine resulted in a reading of the XML body but no control from the phoneme element or the emphasis element. This result (no apparent SSML control) is the same on a Nexus One running Android 2.2 as well as on the emulator running an AVD with SDK level 8.
String text = "<?xml version=\"1.0\"?>" +
"<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
"xsi:schemaLocation=\"http://www.w3.org/2001/10/synthesis " +
"http://www.w3.org/TR/speech-synthesis/synthesis.xsd\" " +
"xml:lang=\"en-US\">" +
"tomato " +
"<phoneme alphabet=\"ipa\" ph=\"təmei̥ɾou̥\"> tomato </phoneme> " +
"That is a big car! " +
"That <emphasis> is </emphasis> a big car! " +
"That is a <emphasis> big </emphasis> car! " +
"That is a huge bank account! " +
"That <emphasis level=\"strong\"> is </emphasis> a huge bank account! " +
"That is a <emphasis level=\"strong\"> huge </emphasis> bank account!" +
"</speak>";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);
Does any Android TTS engine support any of the SSML elements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我一直在尝试 SSML,似乎 TTS 引擎会使用根
元素自动包装其输入,因此如果您将其省略,那么它可以正常工作,而您不需要得到解析器错误。例子:
I've been experimenting with SSML and it seems that the TTS engine wraps its input automaticly with the root
<speak>
element, so if you leave it out, then it works fine and you don't get a parser error.Example:
答案似乎是“有点”。尚未支持所有 SSML 标记,但使用
标记的一些测试示例位于 https://android.googlesource.com/platform/external/svox/+/89292811b7fe82e5c14fa13942779763627e26db所需的语音输出,它们还产生logcat 中的 XML 解析器错误消息。我已在 Android 问题跟踪器(问题 11010)上提出了有关这些看似不正确的错误消息的问题。
The answer seems to be "sort of". Not all the SSML tags are supported yet, but some test examples of the use of the
<phoneme>
tag are at https://android.googlesource.com/platform/external/svox/+/89292811b7fe82e5c14fa13942779763627e26dbThough the test examples produce the desired speech output, they also produce XML parser error messages in logcat. I've opened an issue about these seemingly incorrect error messages at the Android issue tracker (issue 11010).
SDK 级别 23 的
android.speech.tts
似乎确实支持 SSML 的子集。语音文本可以包裹在
标签中,并且
会被观察到,而
则不会。没有有关 SSML 支持的文档。It does appear that
android.speech.tts
at SDK level 23 supports a subset of SSML. Speech text can be wrapped in<speak>
tags, and<say-as>
is observed, while<break>
is not. There is no documentation regarding SSML support.