I am using the pyttsx3 module for text-to-speech in one of my python projects, but I am not able to choose a male/female option for voices. I read the documentation given on https://pypi.org/project/pyttsx3/ where it says use voices[0].id/voices[1].id for male and female voices respectively. However, that does not seem to work as there is no significant difference between the 2 voices.
My code:
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
engine.say("Hello World!")
engine.runAndWait()
Any idea how to change the voice and also is there a way to change the language of text-to-speech...something similar to auto-translate?
this worked for me.