Home > front end >  how to get list all supported voices from Text To Speech in android studio
how to get list all supported voices from Text To Speech in android studio

Time:03-24

I am working on TTS (Text to Speech). And I want to get the list of supported voices, what should I do EXAMPLE:

private TextToSpeech t1;
t1 = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
      if (status != TextToSpeech.ERROR) {
                    t1.setLanguage(Locale.US);
                }
            }
      });
t1.setLanguage(Locale.US);
Voice va=new Voice("en-gb-x-rjs#female_2-local",new
Locale("en","US"),400,200,true,a);

t1.setVoice(va);
String toSpeak = textTitle.getText().toString();
t1.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);

I want have all list as

"en-gb-x-rjs#female_2-local"

CodePudding user response:

As per doc

getVoices() method from TextToSpeech returns set of all the available voices.

  • Related