将以下SSML(Speech Synthesis Markup Language)文档传递给com.svox.pico TextToSpeech引擎会导致读取XML主体,但无法从音素元素或强调元素中进行控制。在运行Android 2.2的Nexus One以及运行具有SDK级别8的AVD的仿真器上,此结果(没有明显的SSML控件)是相同的。
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元素?
最佳答案
我一直在尝试使用SSML,看来TTS引擎会使用根<speak>
元素自动包装其输入,因此,如果不进行处理,它将正常工作,并且不会出现解析器错误。
例子:
String text = "Testing <phoneme alphabet=\"xsampa\" ph=\""{k.t@`\"/>.";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);