Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text to speech for Bangla not working

TTS for bangla content works fine in my Nexus 5x, but not others phone. In other i.e. Samsung phone can speak only english words but skip(not speak) bangla words.

Can anybody fetch this type of problem, please help me.

Thanks.

Code:

@Override
    public void onInit(int i) {
        if (i == TextToSpeech.SUCCESS) {

        int result = mTextToSpeech.setLanguage(new Locale("bn_IN"));//https://stackoverflow.com/questions/7973023/what-is-the-list-of-supported-languages-locales-on-android

        floatRead.setImageResource(R.drawable.ic_volume_off);

        if (result == TextToSpeech.LANG_MISSING_DATA
                || result == TextToSpeech.LANG_NOT_SUPPORTED) {
            Log.i("TTS", "This Language is not supported");
            AppApplication.getInstance().showToast("This Language is not supported");
        }
        read(mNewsDetails.title, true);
        read(mNewsDetails.plain_text, false);

    } else {
        floatRead.setImageResource(R.drawable.ic_read);
    }
    }

`

void read(String text, boolean flush) {
        if (flush == true) {
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
                mTextToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null, null);
            else
                mTextToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
        } else {
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
                mTextToSpeech.speak(text, TextToSpeech.QUEUE_ADD, null, null);
            else
                mTextToSpeech.speak(text, TextToSpeech.QUEUE_ADD, null);
        }
    }

`

like image 549
Newton Avatar asked Oct 14 '17 16:10

Newton


2 Answers

-Google updates the Google TTS version on devices via software updates to make locales supportable.
Please verify in case Google TTS version is same in both device being tested.
As per my information, Google Text-to-speech 3.11.12 added support for Bangla along with various other improvements.
Refer:
Google TTS

-Samsung devices support:
Samsung text-to-speech engine
Google text-to-speech engine

Which in fact have different locale supported sets.

like image 192
ManmeetP Avatar answered Oct 14 '22 12:10

ManmeetP


Its working.

Try to set language & work fine for me.

@Override public void onInit(int i) { ..........

int result = mTextToSpeech.setLanguage(new Locale("bn_IN"));

ref: for language [What is the list of supported languages/locales on Android?

thanks u all.

like image 27
Newton Avatar answered Oct 14 '22 13:10

Newton