Ramesh Solanki
Ramesh Solanki

Reputation: 2936

Using text to speech APIs in android application

I want to use TTS (Text to Speech) APIs in my android application.Now i have one quetions - Is it support TURKISH language ? I also want to highlight word in textview when that perticular word is being spoke.

How can i do it ? Can anybody help me ?

Thanks in advance !

Upvotes: 1

Views: 1055

Answers (3)

elifekiz
elifekiz

Reputation: 1506

You should use Locale type variable.

  final Locale locale = new Locale("tr", "TR");          

  tts = new TextToSpeech(getApplicationContext(), new
  TextToSpeech.OnInitListener() {
        @Override
        public void onInit(int status) {

             if (status == TextToSpeech.SUCCESS) {
                int result = tts.setLanguage(locale);
                if (result == TextToSpeech.LANG_MISSING_DATA
                        || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                    Log.d("class name", "tts error ");
                }
            } else {
                Log.d("class name", "tts error ");
            }
        }
    });
   tts.speak("write here what you want in Turkish", TextToSpeech.QUEUE_FLUSH, null);

Upvotes: 0

Murat
Murat

Reputation: 3294

The TTS engine that ships with the Android platform supports a number of languages: English, French, German, Italian and Spanish. Also, depending on which side of the Atlantic you are on, American and British accents for English are both supported.

http://developer.android.com/resources/articles/tts.html

Upvotes: 0

Reno
Reno

Reputation: 33792

Does it support TURKISH language

This may vary on different handsets/flavours of Android. You can check it out for yourself using the

   mTTS.isLanguageAvailable(new Locale("tr", "TUR"));

I also want to highlight word in textview when that particular word is being spoke.

Well you have a TextToSpeech.OnUtteranceCompletedListener(), to use this you have to speak() each word, one at a time.

Upvotes: 3

Related Questions