PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/documentation/TextToSpeech_Plugin_Engine_Examples/README.txt

http://eyes-free.googlecode.com/
Plain Text | 106 lines | 79 code | 27 blank | 0 comment | 0 complexity | 785ae1d8a4190663eeccd3540d9fd67c MD5 | raw file
  1Architecture summary:
  2
  31/ frameworks/base/core/java/android/speech/tts/TextToSpeech.java
  4This is the public API for TTS. It uses a TTS Android service whose interface 
  5is described in: frameworks/base/core/java/android/speech/tts/ITts.aidl
  6All TTS calls an app makes through the TextToSpeech class are routed to the 
  7service (see the mITts member variable)
  8
  92/ frameworks/base/packages/TtsService/src/android/tts/TtsService.java
 10This is the implementation of the TTS service. It handles the speech queue, 
 11and is responsible for instanciating the actuall speech synthesizer, an 
 12instance of the SynthProxy class, implemented in: 
 13frameworks/base/packages/TtsService/src/android/tts/SynthProxy.java
 14
 153/ frameworks/base/packages/TtsService/src/android/tts/SynthProxy.java
 16This class, when instanciated, is given the full path of the speech synth 
 17native library to load. It is the bridge between Java and native code.
 18
 194/ frameworks/base/packages/TtsService/jni/android_tts_SynthProxy.cpp
 20JNI for the SynthProxy class. It loads the synth native library whose 
 21interface is defined in frameworks/base/include/tts/TtsEngine.h.
 22
 235/ external/svox/pico/tts/com_svox_picottsengine.cpp
 24An implementation of TtsEngine.h which is built into a shared library, 
 25loaded by android_tts_SynthProxy.cpp
 26
 27*******************************************************************************
 28
 29Here are the steps needed to create a TTS plugin that will work with the 
 30Android framework:
 31
 32I. Build the .so file
 33
 34  The main piece of work that you need to do is write an equivalent of 
 35  "com_svox_picottsengine.cpp", ie "com_mytts_ttsengine.cpp". This file 
 36  must implement "TtsEngine.h" as seen here:
 37http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=include/tts/TtsEngine.h;hb=master 
 38
 39  Use the Android NDK to build your .so file.
 40  See http://developer.android.com/sdk/ndk/index.html
 41
 42*******************************************************************************
 43    
 44II. Package it inside an Android apk file.
 45
 46The Java APK wrapper MUST implement the following Activities:
 47<NameOfEngine> - Declares which languages are potentially supported, name of 
 48the engine, etc. This is a dummy Activity that is used to get some basic info 
 49about the engine.
 50
 51DownloadVoiceData - Downloads data; this is the Activity that will be called 
 52if the engine is selected under TTS Settings and it needs voice data.
 53
 54CheckVoiceData - Determines which voices are actually present on the system. 
 55This will be used to determine which Languages the user can choose from in 
 56TTS Settings.
 57
 58GetSampleText - Sample text to be spoken to the user when they click 
 59"Listen to an example" in TTS Settings.
 60
 61------------------------
 62The Java APK wrapper can implement this Activity if it has Settings 
 63for the user to configure:
 64EngineSettings - Engine specific configuration. This is the Activity 
 65that will be called if the user clicks on the engine specific settings 
 66under "Engines" in TTS Settings. What the user sets here will be passed 
 67to the .so as one String; it will be retrieved by the TTS Service by 
 68querying it from the engine's providers.SettingsProvider and then passed 
 69back to the .so in the native layer. If this is not implemented by your engine, 
 70the area under "Engines" will only have the enable/disable checkbox for 
 71your engine; there will not be a settings entry for your engine.
 72
 73------------------------
 74The Java APK wrapper can also implement this Content Provider:
 75providers.SettingsProvider - Provides the String of config data that is to 
 76be passed to the engine's .so file. Normally this would be some data that 
 77you get from what the user has set in your EngineSettings Activity. The 
 78framework does not attempt to parse this data or do anything with it. 
 79It is up to the plugin vendor's Java wrapper to come up with this String, 
 80and it is up to the plugin vendor's engine .so to consume it. If you don't 
 81have this Content Provider, the native layer will just get an empty 
 82string passed to it.
 83
 84------------------------
 85
 86For apps that use TTS, we expect that developers will probably want to use 
 87the dummy NameOfEngine Activity to narrow down which engines have support 
 88for the languages they are interested in, followed by invoking CheckVoiceData 
 89for the specific languages they are interested in.
 90
 91For examples, see: 
 92http://code.google.com/p/eyes-free/source/browse/#svn/trunk/documentation/TextToSpeech_Plugin_Engine_Examples
 93    
 94Also, for a 3rd party example, see Flite for Android: 
 95http://github.com/happyalu/Flite-TTS-Engine-for-Android
 96    
 97*******************************************************************************
 98
 99III. Stress test your TTS
100
101Make sure your TTS can handle starting and stopping speech rapidly. The easiest
102way to stress test your TTS is to use it with Android's built in TalkBack 
103screen reader application and scroll around the various menus in Android. To 
104enable TalkBack: Settings > Accessibility > TalkBack.
105
106