I want the Microsoft David Voice for my pyttsx3 module. I wrote the following code. With voices[0].id
it is giving Zira (Female voice) and when I use voices[1].id
it shows error list is out of index
. Please help. How do I get David Voice?
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id) #changing index changes voices but ony 0 and 1 are working here
engine.say('Hello World')
engine.runAndWait()
Traceback (most recent call last):
File "C:/Users/admin/Desktop/delet.py", line 4, in <module>
engine.setProperty('voice', voices[1].id) #changing index changes voices but ony 0 and 1 are working here
IndexError: list index out of range