Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we handle "Is not audiable" in Text-To-Speech(tts)?

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!!

like image 718
Apple Appala Avatar asked Nov 25 '25 17:11

Apple Appala


1 Answers

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'.

like image 85
brandall Avatar answered Nov 27 '25 05:11

brandall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!