Android text for speech. Male voice.

I have a working text for speech, but I wondered instead of a female voice, when the application calls it playback, will it make a male voice instead?

+4
source share
5 answers

Now you can use the male / female voice and dynamically change it from the user interface of the application. Define a TTS like this (add the google tts engine to the constructor):

tts = new TextToSpeech(context, this, "com.google.android.tts"); 

contex = activity / app

this = TextToSpeech.OnInitListener

In the tts.getVoices() list, select the desired voice by name:

 for (Voice tmpVoice : tts.getVoices()) { if (tmpVoice.getName().equals(_voiceName)) { return tmpVoice; break; } } 

NB: U need to set _voiceName , getting a hard-coded voice name from tts.getVoices() . for example: for an English man it would be: "en-us-x-sfg # male_1-local"

+5
source

You cannot make Android TextToSpeech sound like a man. If you change the value of TextToSpeech.setPitch () to something low, like 0.1, it will sound very bad.

Your only option is to try another Text-to-Speech engine or live with a female-sounding voice.

+3
source

It depends on the underlying TTS mechanism. Some of them are customizable and have different voices (men, women, etc.), some of them have only one voice. In any case, you cannot control this from your application, the user must change the settings of the TTS engine from the Settings application. You could only instruct them on installing a specific engine and configure the application to use it.

+1
source

You can change the voice to men. Set onCreate() : tts.setEngineByname("com.google.android.tts") and set the default google tts service in the text-to-speech settings and set the male voice in google tts service.

Similarly, you can use any third-party android tts services and check the device. Or ask to install.

+1
source

In any case, you can customize your Android text to speech in the Google TTS service:

  • tts = new TextToSpeech(context, this, "com.google.android.tts") , or
  • Install a new male (English) voice and set it to default in android.

Hope this helps.

0
source

Source: https://habr.com/ru/post/1402789/


All Articles