gotev / android-speech

Android speech recognition and text to speech made easy
http://gotev.github.io/android-speech/
Apache License 2.0
486 stars 157 forks source link

Is there a way to change the voice of the speech engine ? #41

Closed nithusv closed 3 years ago

gotev commented 3 years ago

Yes. Check https://github.com/gotev/android-speech#set-speech-to-text-language-and-text-to-speech-voice

nithusv commented 3 years ago

Thanks. But when clicking on voice selection menu in the demo app, the app crashes. Please look into it.

gotev commented 3 years ago

@nithusv please post here the exception you get when running it. Tested on my devices without issues.

nithusv commented 3 years ago

@gotev

If I click Set Speech to text language option the app freezes and it quits. (I think it is doing network operation or a heavy operation on ui thread, maybe moving it to background thread may solve it)

This was the exception caught, Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.resolveTypeIfNeeded(android.content.ContentResolver)' on a null object reference at android.app.ContextImpl.sendOrderedBroadcast(ContextImpl.java:1229) at android.app.ContextImpl.sendOrderedBroadcast(ContextImpl.java:1185) at android.content.ContextWrapper.sendOrderedBroadcast(ContextWrapper.java:493) at net.gotev.speech.Speech.getSupportedSpeechToTextLanguages(Speech.java:343) at net.gotev.speechdemo.MainActivity.onSetSpeechToTextLanguage(MainActivity.java:115) at net.gotev.speechdemo.MainActivity.onOptionsItemSelected(MainActivity.java:102) at android.app.Activity.onMenuItemSelected(Activity.java:4150) at androidx.fragment.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:436) at androidx.appcompat.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:196) at androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:109) at androidx.appcompat.app.AppCompatDelegateImpl.onMenuItemSelected(AppCompatDelegateImpl.java:888) at androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:840) at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:158) at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:991) at androidx.appcompat.view.menu.MenuPopup.onItemClick(MenuPopup.java:128) at android.widget.AdapterView.performItemClick(AdapterView.java:330) at android.widget.AbsListView.performItemClick(AbsListView.java:1257) at android.widget.AbsListView$PerformClick.run(AbsListView.java:3265) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7697) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

gotev commented 3 years ago

Thanks for the report. On which Android version does it happen? Also, do you have the Google App installed?

nithusv commented 3 years ago

I have google app installed running on Android 10.

gotev commented 3 years ago

@nithusv try version 1.6.0 and let me know

nithusv commented 3 years ago

@gotev It is working fine now. ⭐️