Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't change the gender..., what i'm doing wrong? #25

Closed
rainfuse opened this issue May 31, 2014 · 1 comment
Closed

I can't change the gender..., what i'm doing wrong? #25

rainfuse opened this issue May 31, 2014 · 1 comment

Comments

@rainfuse
Copy link

Hi, first awesome lib! I'm using under linux and was preety easy to start, but now I want to change the speech to female... I'm trying with the code below without success... can you please help me?

import pyttsx

def say(text):
print "{}".format(text)
engine = pyttsx.init()
voices = engine.getProperty('voices')
for voice in voices:
print voice.gender
engine.setProperty('female', voice.gender)
print "change: {}".format(voice.gender)
engine.say(text)
engine.runAndWait()

Thanks

@parente
Copy link
Collaborator

parente commented Jun 1, 2014

The gender is a read-only property on a voice. To speak in a female voice, find a voice that has gender=female and use engine.setPropert('voice', voice.id) to set the engine to use that female voice.

There's an example here in the documentation:

http://pyttsx.readthedocs.org/en/latest/engine.html#changing-voices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants