标签: saiy

Text to Speech 获取系统默认音调和语速

当用户将网络合成语音设置为默认值时,我的应用程序会缓存常见的请求以防止未来的网络延迟。

我如何做到这一点,是体现在我的代码在这里。简而言之,它将引擎名称和话语与请求匹配,如果它们匹配,我会流式传输缓存的音频而不是使用 TTS 引擎。

如果用户随后在 Android 文本到语音设置中更改了他们的音调和语速,则缓存的音频当然将不再反映这一点,并且需要被忽略并“重新缓存”,或者相应地处理音频。

我的问题:如何获得系统默认设置,用于音调和语速。

设置音调和速率,TextToSpeech API中提供了公开的方法:

/**
 * Sets the speech rate.
 *
 * This has no effect on any pre-recorded speech.
 *
 * @param speechRate Speech rate. {@code 1.0} is the normal speech rate,
 *            lower values slow down the speech ({@code 0.5} is half the normal speech rate),
 *            greater values accelerate it ({@code 2.0} is twice the normal speech rate).
 *
 * @return {@link #ERROR} or {@link …
Run Code Online (Sandbox Code Playgroud)

java android text-to-speech saiy

3
推荐指数
1
解决办法
3307
查看次数

标签 统计

android ×1

java ×1

saiy ×1

text-to-speech ×1