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 !
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.
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.
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);
来源:https://stackoverflow.com/questions/8381216/using-text-to-speech-apis-in-android-application