how to change voice on pyttxs using voice.ID?

719 Views Asked by At

I know that this question is asked a lot(I've been browsing through dozens of questions like mine), but I'm not able to find a solution.

I know that using

voices = engine.setProperty('voice', 'id')

should change the voice, but using

voices = engine.setProperty('voice' b'english-us')

doesn't seem to work. I've tried putting b'english-us' between quotation marks, but doesn't work either. If I could get the voice to change I'd be satisfied, but my intention is to use a voice from eSpeak, which according to various answers on different forums is actually possible.

Can anybody help me? I'm using python 3.5.3 and pyttsx 1.2

1

There are 1 best solutions below

0
On BEST ANSWER

I found out a way to select the voice.

engine = pyttsx.init() 
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[whatever].id)

Being whatever the place of the voice in the array.