Custom Python gTTS voice

Question:

I have been using the gTTS module for python 3.4 to make mp3 files of spoken text. It has been working, but all of the speech is in a certain adult female voice. Is there a way to customize the voice that gTTS reads the text in?

Asked By: Theo D.

||

Answers:

Unfortunately it does not appear you can do that. The script uses this webpage to grab voice from, and it appears all you can do is have one voice per language.

Reading the actual source shows that your next best bet would be to try to pass a different language that is still English (for example, en-uk). It may produce a different result that is still English but with a different dialect.

Answered By: Kush

May be possible to pass the gTTS output through Audacity and apply a change to a male-sounding voice? gTTS I have just got going has a very good female voice, but the engine fails to read well on long sentences or unexpected words. Still, it’s the best I found for free so far, and actually is better than all the other free ones, and a good deal of the pay ones. I just had to work out the py scripts and how to use python and later learned Anaconda is a miracle cure to what ails you. Got my systems terminal and the pip to install gTTS properly, which I could not do prior to Anaconda. Scripts made by people for 3.+ now run without errors trying run them in default py v2.7. The terminal is now env 3.6.8 but also all the old py scripts still run fine.

Answered By: user270073

You can always use pyttsx3,
It defaults to male, but you can change it to female voice as well and there are a lot more parameters you can change like speed and volume. I thing gtts voice quality is slightly better still though.
Here is some documentation to get you started if you want to use it: https://www.geeksforgeeks.org/text-to-speech-changing-voice-in-python

Answered By: Wudfulstan

If you call "gtts-cli –all" from a command prompt, you can see that gTTS actually supports a lot of voices. However, you can only change the accents, and not the gender.

Answered By: thisisnotshort

You can easily change the output-language by passing an second parameter when requesting a tts. So go like:

tts = gTTS("Say something", lang = 'XX') #replace XX with your language code

On the python doc website for Google Text-to-Speech you can find a table with some of the language codes from a few countrys.

Answered By: rocketFox

Yes, you can customize the text in a few languages and accents. You can find the full documentation here:

gTTS docs

You can try the different languages and accents this way:

tts_obj = gTTS(text=tts, tld=tlds["South Africa"], lang=lang, slow=False)
Answered By: Chris J

yes, you can do that if you want to change the language or give another accent.
gTTS('hello', lang='en', tld='com.au').
where ‘tld’ parameter is used for accent. for more accent check this .

Answered By: Deven Kumbhani