1

I am trying to set Text to speech object language as Kannada. below is code where i am setting the language whose language code is kn as per the documentation. But somehow i m getting the error message as language not supported

int result = tts.setLanguage(new Locale("kn", "IN"));
        if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
            Log.e("TTS", "This Language is not supported");
            result = tts.setLanguage(Locale.US);

            if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                result = tts.setLanguage(Locale.ENGLISH);

            }

        }

Please suggest What are the approaches for the playing this text in kannada language or any other language. If any api will provide it it will help me alot

Cœur
  • 37,241
  • 25
  • 195
  • 267
Feroz Siddiqui
  • 3,840
  • 6
  • 34
  • 69
  • 2
    You can [check](https://stackoverflow.com/questions/4872702/get-available-locales-for-text-to-speech-tts) whether Kannada is supported on your device. If it isn't... there's not much you can do except complain, I suppose. – Amadan Jun 28 '18 at 11:07
  • yeah its not there then how can i play this ? will change the question as well – Feroz Siddiqui Jun 28 '18 at 11:09
  • kn language is supported in my phone but still its not working these are two categories of lang cod available in my phone kn, kn_IN – Feroz Siddiqui Jun 28 '18 at 11:16
  • Are you saying TTS for Kannada is supported, or just that locale is supported? The two are not the same. Also, Google around, I think Android allows third-party developers to add TTS support for extra languages. – Amadan Jun 28 '18 at 11:19
  • Locale loc = new Locale("en"); Log.i("-------------", Arrays.toString(loc.getAvailableLocales())); i use this function call to view the available locales – Feroz Siddiqui Jun 28 '18 at 11:27
  • You still need to check whether the locale has TTS available. BTW, the accepted answer in the question I linked makes no sense, read comments and other answers. In particular, `tts.getAvailableLanguages()` and/or `tts.isLocaleAvailable(locale)`. – Amadan Jun 28 '18 at 11:30
  • I think this is happening due continuous change of different language like english , hindi, kannada on same TTS object. I am setting the language based on button click by the user – Feroz Siddiqui Jun 28 '18 at 11:33
  • Either choose a different TTS engine OR use mp3 files with a someone's voice saying predetermined sentences or words. – Phantômaxx Jun 28 '18 at 12:32

0 Answers0