I am trying to work with the pyttx3
library and I am trying to output speech by supplying a text to engine.say('My text')
, then I run the engine.runandwait()
function but the program just stays there and does nothing.
Here is my code:
import pyttsx3
def speak(audio):
engine.say(audio)
engine.runAndWait()
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
speak("Best")