0

I have questions regarding the implementation of tts service for android. Here's the deal:

-I've looked over Flite code and I see that service is require to have these 3 activities:

<activity
        android:name=".DownloadVoiceData"
        android:label="@string/flite_voice_manager"
        android:theme="@android:style/Theme.Holo" 
        android:configChanges="orientation">
        <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:label="@string/app_name"
        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:label="@string/app_name"
        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>

The actual actions of these activities are self explainable, but I want to know: Are they mandatory, how they work .... I have google it but with no luck.

  1. Can anybody point out to some documentation where these activities are explained?

  2. Also, is there any documentation of tts service flow explained in detail?

Thanx in advance.

someone
  • 23
  • 1
  • 5
  • What are you trying to achieve, in normal cases you don't have to worry about these classes/activities , because they are automatically called by the tts engine? – Mr.Me Feb 02 '13 at 10:59
  • I want to know more about them. WHat data should I provide, what components to have in xml for each activity? Do I need them? What if I want to upload to device audio files via usb etc... – someone Feb 02 '13 at 20:37
  • Sorry about my previous answer , I was talking about ASR, anyway here is the link to android's documentations of it http://developer.android.com/reference/android/speech/tts/package-summary.html also android uses pico tts engine in case you want to know about the engine it self. Sorry about the confusion – Mr.Me Feb 02 '13 at 22:30
  • Hm, its not helping me a lot. I will look further. When I find a explanation of it, I will post it here. In the meantime I want to thank Mr.Me and ask others to contribute:) – someone Feb 02 '13 at 22:58

1 Answers1

0

CheckVoiceData is necessary because it may be invoked by a client willing to know if the engine will work. I think you can live without the other two at least for some time.

    <activity android:name=".CheckVoiceData"
            android:theme="@android:style/Theme.NoDisplay">
        <intent-filter>
            <action android:name="android.speech.tts.engine.CHECK_TTS_DATA" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

In CheckVoiceData.onCreate() you will do something like this:

    ArrayList<String> askedToCheck = intent.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_CHECK_VOICE_DATA_FOR);
    // if it is null, they usually check and report all available languages.


    ArrayList<String> available = new ArrayList<String>();
    ArrayList<String> unavailable = new ArrayList<String>();

    //...

    Intent returnData = new Intent();
    returnData.putStringArrayListExtra(
            TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES, available);
    returnData.putStringArrayListExtra(
            TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES, unavailable);
    setResult(result, returnData);
    finish();

An example of a valid language string is "eng-USA".

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127