3

I have no problems with using English Language. I am from Nepal and my app also uses Nepali language as well, Now, If I try to make speak Nepali word then nothing happens.. i.e. tts cannot pronounce although there isn't Nepali language to Locale. I got the following logcat error when I try to play tts with Nepali word:-

09-14 16:47:48.781 11035-26114/? I/patts: Failure to verbalize in FST ALL: for markup [verbatim: "न" ] (and permutations)
09-14 16:47:48.784 11035-26114/? I/patts: Failure to verbalize in FST ALL: for markup [verbatim: "ि" ] (and permutations)
09-14 16:47:48.787 11035-26114/? I/patts: Failure to verbalize in FST ALL: for markup [verbatim: "ल" ] (and permutations)
09-14 16:47:48.790 11035-26114/? I/patts: Failure to verbalize in FST ALL: for markup [verbatim: "े" ] (and permutations)
09-14 16:47:48.793 11035-26114/? I/patts: Failure to verbalize in FST ALL: for markup [verbatim: "श" ] (and permutations)
09-14 16:47:48.805 11035-26114/? I/patts: Is not audiable (output is only silence)

Anyway to handle in these situation?, I just want tts to speak that "Nepali Language Is not Supported" when try to play nepali words.

Below is my code of tts, I don't think it's important but also I am posting below:-

 holder.imageButton_tts.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            holder.tts.speak(names.get(position).textView,TextToSpeech.QUEUE_ADD,null);
            holder.tts.setLanguage(Locale.US);  //There is no Nepali language provided by android, Locale code for Nepali is NE
            holder.tts.setPitch(0.7f);
            holder.tts.setSpeechRate(0.4f);
        }
    });

Any Helps and suggestions will be appreciate!! ^_^

Note:- In stackoverflow Text-To-Speech tags are rarely found question, If you can't answer then please do vote up for the question, which helps me to find answer quickly. I don't have points to make question attractive!! Please!! Please!! Please!!

Apple Appala
  • 329
  • 4
  • 16
  • Did you download the Nepali language TTS data? – Phantômaxx Sep 14 '16 at 11:25
  • No, Can It be downloaded? – Apple Appala Sep 14 '16 at 11:26
  • I don't know... did you even try? – Phantômaxx Sep 14 '16 at 11:26
  • I just google just now as you say, So far I have found link http://www.mycomputersathi.com/2016/07/download-nepali-text-to-speech.html but don't know this gonna pronounce in nepali or not. But also later I may need to handle these kind of situations. So, I wanna know how to handle!! – Apple Appala Sep 14 '16 at 11:31
  • try searching `tts voices android nepali` – Phantômaxx Sep 14 '16 at 11:32
  • @Rotwang also, searched as you say keyword but only one link was found so far. – Apple Appala Sep 14 '16 at 11:36
  • By using the **very same keywords**, I found... http://tts.kaushalsubedi.com/, http://espeak.sourceforge.net/, https://sourceforge.net/directory/os:windows/?q=nepali%20text%20to%20speech, http://www.mycomputersathi.com/2016/07/download-nepali-text-to-speech.html **and many more**. – Phantômaxx Sep 14 '16 at 11:42
  • @Rotwang the first link is not a downloadable link of tts. This is a online website which converts Nepali text into tts into audio.wav format however the second link and third link doesn't link to Nepali and doesn't have any download links and the last one mycomputersathi.com which is somewhat helpful but unluckly, when I click the download button, it redirects me to the page "page not found" :( – Apple Appala Sep 14 '16 at 14:27
  • I see. Well... don't give up. Maybe contact the owner of the missing link page. – Phantômaxx Sep 14 '16 at 14:48
  • 1
    I was just looking in espeak.sourceforge.net, it's not the API for android but was the API for web. :( I'll contact them, anyway thanks buddy @Rotwang for your effort!! :) – Apple Appala Sep 14 '16 at 15:01
  • Since you only need to pronounce one single Nepali sentence, it might be realistic to study the Android TTS engine's support for phonetic symbols to make e.g. the English voice to pronounce that sentence. See e.g. [this](http://stackoverflow.com/questions/3495301/best-practice-for-specifying-pronunciation-for-android-tts-engine/3647869) and [this](http://stackoverflow.com/questions/3525424/does-android-tts-support-speech-synthesis-markup-language) discussion to get started. I haven't studied that topic myself so this is just an idea that might work well enough with some trial and error. – Markus Kauppinen Sep 14 '16 at 15:46
  • @MarkusKauppinen No, My intention is not going so much deep, I just want that tts to speak that "Nepali is not supported" in English language instead of being silent!! Any way, using if{} else {} or any.. – Apple Appala Sep 14 '16 at 16:52
  • An [UtteranceProgressListener](https://developer.android.com/reference/android/speech/tts/UtteranceProgressListener.html) would at least allow you to detect TTS engine errors. With lower API versions there's just a generic "error" and even with the most recent APIs the error codes aren't very specific. But it could be useful. Here's a [simple example](http://stackoverflow.com/questions/37004546/when-to-use-the-utteranceprogresslistener). – Markus Kauppinen Sep 14 '16 at 17:30

1 Answers1

1

You can do four things here.

  1. If you know from your string resources that the language is Nepali, then you can avoid attempting to get the TTS engine to speak in the first place and raise a toast

  2. Use tts.isLanguageAvailable(Locale loc) for the Nepali Locale. Check here for the probable negative responses. Assuming the response is negative, raise the toast.

  3. Check the response of setLanguage(), same as above

  4. Check the response of tts.speak(...). Under the circumstances you provide above, you would expect this to return ERROR. You can raise you toast.

I would like to think that at least one of the above would provide you with an error, so you can toast to the user. The same approach should be applied to any Locale you app 'supports'.

Community
  • 1
  • 1
brandall
  • 6,094
  • 4
  • 49
  • 103