Any Tts Api For Android In Turkish?
Is there any free TTS (text-to-speech) service for Android in Turkish? I've not found anything useful in google.
Solution 1:
I didnt try it yet on android, but I recently discovered this one: http://www.ispeech.org The speech quality looks promising on the web app.
Give it a shot :)
Solution 2:
Here you can use Google TTS as below:
strText = converToTurkishCharacter(strText);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
textToSpeech = newTextToSpeech(getApplicationContext(), newTextToSpeech.OnInitListener() {
@OverridepublicvoidonInit(int status) {
Localelocale=newLocale("tr_TR");//set Locale
textToSpeech.setLanguage(locale);
if (status != TextToSpeech.ERROR) {
}
if (status == TextToSpeech.SUCCESS) {
String[] text = strText.split("\\.");//split with every "dot"for (inti=0; i < text.length; i++) {
HashMaputtrerance=newHashMap();
uttrerance.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, Integer.toString(i));
textToSpeech.speak(text[i], 1, uttrerance);
}
}
//-------checks engineListengineList= textToSpeech.getEngines();
for(Object strEngine : engineList){
Log.d("tagg",strEngine.toString());
if(strEngine.toString().equals("EngineInfo{name=com.google.android.tts}")){//check if google tts api engine is installed on device
isGoogleAvaible = true;
}
}
if(!isGoogleAvaible){
Toasttoast= Toast.makeText(ActivityColumnistArticle.this,
"Google TTS Eksik...Lutfen yukleyin", Toast.LENGTH_LONG);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
Intentintent=newIntent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.google.android.tts"));
startActivity(intent);//user should install google tts , if it is defaultly not installed
}
//---------------For missing dataintcode= textToSpeech.isLanguageAvailable(locale);
if (code == -2 || code == -1) {
IntentinstallIntent=newIntent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
}
}
}, "com.google.android.tts");
}
else{
Toasttoast= Toast.makeText(ActivityColumnistArticle.this,
"Ses destegi icin minumum Icecream Sandwich yuklu olmalı...", Toast.LENGTH_LONG);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
Moreover, Google TTS have bug with türkish character like "ö", "ğ" so that you should convert them with unicode:
privateStringconverToTurkishCharacter(String text){
text = text.replace("\u015f", "\u015f");
text = text.replace("\u00e7", "\u00e7");
text = text.replace("\u011f", "\u011f");
text = text.replace("\u0131", "\u0131");
text = text.replace("\u00fc", "\u00fc");
text = text.replace("\u00f6", "\u00f6");
// ----
text = text.replace("\u011e", "\u011e");
text = text.replace("\u0130", "\u0130");
text = text.replace("\u00d6", "\u00d6");
text = text.replace("\u00dc", "\u00dc");
text = text.replace("\u015e", "\u015e");
text = text.replace("\u00c7", "\u00c7");
return text;
}
Some android device have pico TTS only, so that is why you check Google TTS, and ask user to install...
Not:In order tts to work,You should have real android device
Solution 3:
I fixed this problem in my case,
define that variable:
final Locale locale = new Locale("tr", "TR");
in onCreate method:
tts = newTextToSpeech(getApplicationContext(), newTextToSpeech.OnInitListener() {
@OverridepublicvoidonInit(int status) {
if (status == TextToSpeech.SUCCESS) {
intresult= tts.setLanguage(locale);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
tts.speak("bir sorun oluştu", TextToSpeech.QUEUE_FLUSH, null);
}
} else {
tts.speak("bir sorun oluştu.", TextToSpeech.QUEUE_FLUSH, null);
Log.d(TAG, "Text to speech is not successful");
}
}
});
tts.speak("bağlanıyor", TextToSpeech.QUEUE_FLUSH, null);
it will say "bağlanıyor"
Solution 4:
just use Locale.getDefault()
tts.setLanguage(Locale.getDefault())
Post a Comment for "Any Tts Api For Android In Turkish?"