0

I have recently install pyttsx3 and I use the code:

import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()

But when I run this program, I have some problems: enter image description here

I don't how to handle this :(

1 Answers1

0

Try this program. I have had some experience with this.

engine = pyttsx3.init('sapi5')<--- Sapi5 is Win 10 only. Find the one for your system.
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)

def speak(audio):
    engine.say(audio)
    engine.runAndWait()

Then this is what you do for it to speak:

speak("I am speaking this right now")
Redgar Tech
  • 347
  • 3
  • 13