Mohamad Azrie Mohamad Azrie - 1 year ago 96
Android Question

Text-To-Speech (android - java) output not the same as Google TTS output

Currently I'm developing an app that involve text to speech. I'm facing a problem where the speech output is not the same as google's TTS engine output. Instead of getting language that I set up (example : German), I receive an output of english language with a german accent. So I'm a little bit confuse what's going on and I've tried multiple solution but it still not working as I intended. Below is my source code.

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

String languageLocale = preferences.getString("langTest",null);
String languageDisplayName = preferences.getString("language",null);
float speed = preferences.getFloat("speed",0);
float pitch = preferences.getFloat("pitch",0);

Locale[] locales = Locale.getAvailableLocales();

for(Locale locale : locales){
Log.d("Check Locale", " getDisLang: " + locale.getDisplayLanguage() + " // getLang: " + locale.getLanguage() + " // language: " + language);

Answer Source

The text you pass off to the TTS service, is it German? If it is English, then yes, I would expect it to be English as a German might pronounce it.

TTS only translates text to speech. It doesn't translate one language to another. To do that latter, you might try Google's Translation services. Keep in mind that Automatic Translation Services are far less likely to produce acceptable results than TTS services. Apparently a true language-to-language translation is harder to perfect than a "set of words to a set of sounds" service.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download