我已经在Android中开发了我自己的TTS应用程序。有没有办法将TTS引擎部署到操作系统中,而不是运行TTS应用程序,以便其他应用程序可以调用我的TTS?像MS Window中的SAPI。 SVOX可以将引擎打包为apk,并且在安装之后,它会将新引擎添加到Andorid操作系统中,不知道我该怎么做。将我的TTS引擎添加到Android TTS Serivce like SAPI
6
A
回答
4
要使文本到语音引擎显示在可用服务列表中,您需要添加适当的活动和清单条目。
对于API 14以上,你需要扩展TextToSpeechService,你需要以下内容添加到您的清单:
<service
android:name=".MyTextToSpeechService"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.TTS_SERVICE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.speech.tts"
android:resource="@xml/tts_engine" />
</service>
此引用RES/XML/tts_engine.xml,这应该是这样的:
<?xml version="1.0" encoding="utf-8"?>
<tts-engine xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.example.MyTtsSettingsActivity" />
您还需要添加各种辅助活动。这里就是你会被添加到您的清单:
<activity
android:name=".DownloadVoiceData"
android:theme="@android:style/Theme.Dialog" >
<intent-filter>
<action android:name="android.speech.tts.engine.INSTALL_TTS_DATA" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".CheckVoiceData"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.speech.tts.engine.CHECK_TTS_DATA" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".GetSampleText"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.speech.tts.engine.GET_SAMPLE_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".TtsSettingsActivity"
android:label="@string/tts_settings_label" >
<intent-filter>
<action android:name="android.speech.tts.engine.CONFIGURE_ENGINE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Legacy code for pre-ICS compatibility. -->
<activity
android:name=".MyTtsEngine"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.START_TTS_ENGINE" />
</intent-filter>
</activity>
<provider
android:name="com.googlecode.eyesfree.espeak.providers.SettingsProvider"
android:authorities="com.googlecode.eyesfree.espeak.providers.SettingsProvider" />
如果你在支持的Android ICS之前的版本计划,您还需要符合特定的API共享库。
我不会去到每一个活动的实施细节这里,或进入ICS预API,但你可以找到在源代码示例,eSpeak文字转语音引擎的Android端口: http://code.google.com/p/eyes-free/source/browse/trunk/tts/espeak-tts/
相关问题
- 1. 扩展android TTS引擎
- 2. 具有多种语音的SAPI TTS引擎
- 3. 多语言TTS引擎
- 4. 使用MS SAPI TTS无意间变化TTS
- 5. tts设置声音使用发声tts引擎
- 6. Android TextToSpeech初始化 - 将默认TTS引擎设置为“android.speech.tts”
- 7. 让SAPI TTS说话字符串变量
- 8. Android“说话失败:不会绑定到tts引擎”
- 9. Chrome TTS,Google TTS,Cloud Speech API和Android TTS有什么区别?
- 10. Android TTS语言
- 11. Android TTS语音
- 12. Android MediaPlayer TTS问题
- 13. 如何动态地将语言环境设置为TTS引擎?
- 14. 如何将葡萄牙语语言设置为TTS引擎?
- 15. TTS引擎暂停(),恢复()没有存储到SD卡中的android
- 16. 从服务的Android tts
- 17. Android的TTS与韩语
- 18. Android的TTS没有设备
- 19. 如何在Chrome应用中添加TTS?
- 20. TTS课堂:如何TTS中文拼音?
- 21. TTS阅读微博android
- 22. TTS和播放声音 - Android
- 23. Android TTS不会发言
- 24. 文字转语音(TTS)-Android
- 25. TTS Android删除addSpeech项目?
- 26. 如何为tts创建自定义sapi语音
- 27. 发言失败:tts引擎连接未完全设置
- 28. 创建TTS包
- 29. BroadcastReceiver TTS和卷
- 30. TTS BlackBerry API