I have developed my own TTS apps in Android. Is there any way to deploy my TTS engine into the OS instead on running the TTS apps, so that other apps can call my TTS? Something like SAPI in MS Window. SVOX can package the engine as apk and after installed, it adds new engines into the Andorid OS, not sure how can I do that same.
Speechify is the #1 audio reader in the world. Get through books, docs, articles, PDFs, emails - anything you read - faster.
With text-to-speech, your device can convert text input and play audio aloud.
For your text-to-speech engine to show up in the list of available services, you'll need to add the appropriate activities and manifest entries.
For API 14 and above, you need to extend TextToSpeechService and you need to add the following to your manifest:
<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>
This references res/xml/tts_engine.xml, which should look like this:
<?xml version="1.0" encoding="utf-8"?>
<tts-engine xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.example.MyTtsSettingsActivity" />
You'll also need to add a variety of supporting activities. Here's what you'll be adding to your manifest:
<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" />
If you're planning on supporting pre-ICS versions of Android, you'll also need a shared library that conforms to a specific API.
I won't go into details of the implementation of each activity here, or into the pre-ICS API, but you can find examples in the source code for the Android port of eSpeak TTS engine: http://code.google.com/p/eyes-free/source/browse/trunk/tts/espeak-tts/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With