Android TTS 支持语音合成标记语言吗?

发布于 2024-09-15 08:10:20 字数 1506 浏览 6 评论 0原文

将以下 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&amp;#x259;mei&amp;#x325;&amp;#x27E;ou&amp;#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&#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);

Does any Android TTS engine support any of the SSML elements?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

葬心 2024-09-22 08:10:20

我一直在尝试 SSML,似乎 TTS 引擎会使用根 元素自动包装其输入,因此如果您将其省略,那么它可以正常工作,而您不需要得到解析器错误。

例子:

String text = "Testing <phoneme alphabet=\"xsampa\" ph=\""{k.t@`\"/>.";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);

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:

String text = "Testing <phoneme alphabet=\"xsampa\" ph=\""{k.t@`\"/>.";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);
情愿 2024-09-22 08:10:20

答案似乎是“有点”。尚未支持所有 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/+/89292811b7fe82e5c14fa13942779763627e26db

Though 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).

几味少女 2024-09-22 08:10:20

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文