Python – How to set property: age, gender or language in PYTTS (Python)

pythonpython-2.7pyttsxtext-to-speech

I'm using TTS in python. (pyttsx library).
I read in documentation that I can get properties rate, voice, voices, volume. In documentation is only about that I can set property only for rate, voice, volume. It means that I can't set properties "voices"? I'm interested in voices, because it contains age, gender, languages etc.
documentation here: http://pyttsx.readthedocs.io/en/latest/engine.html#pyttsx.voice.Voice

I can use rate, voice, volume easly for example:

engine = pyttsx.init()
engine.getProperty('rate')
engine.getProperty('volume')
engine.setProperty('rate', 50)
engine.setProperty('volume', 0.25)
engine.say("something")
engine.runAndWait()

The question is. Is there a chance to change "gander", "age" or "language" of speaking voice? If there is, please give me an example of how to do it, because I'm totally out of ideas.

There is an example of using voices.id, which is inside voices actually, but it didn't helped me out:

engine = pyttsx.init()
voices = engine.getProperty('voices')
for voice in voices:
   engine.setProperty('voice', voice.id)
   engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()

sorry for bothering you, thanks 🙂

Best Answer

I found this question while trying to solve the exact same problem. After some trials, a more careful inspection of the documentation made it clear to me that those attributes are pertinent to the installed voices in the system (it is referred to as "The Voice metadata" in the documentation), hence you cannot modify them, only read them for the sake of information, or for other "read-only" reasons.