gotev / android-speech

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

Changing Voice #46

Closed ibrahim-iqbal closed 3 years ago

ibrahim-iqbal commented 3 years ago

I'm trying to change the default voice to a male voice using the setVoice method, Bu t it doesn't seem to work

Speech.getInstance ( ).setVoice ( new Voice ( "en-us-x-sfg#male_1-local" , Locale.ENGLISH , Voice.QUALITY_HIGH , Voice.LATENCY_VERY_LOW , false , a ) );

gotev commented 3 years ago

That's not going to work. Try the demo app on your device and check the code to achieve this: https://github.com/gotev/android-speech/blob/master/examples/demoapp/app/src/main/java/net/gotev/speechdemo/MainActivity.java#L168

You have to use one of the voices returned to you by the system and not creating a new object on your own