So, I'm trying to create a talking engine with pyttsx
in python3, when I first call the function to say something it works fine, if I call it again, it just says the first word of the sentence and nothing happens.
import pyttsx
class Speech(object):
def __init__(self):
self.engine = pyttsx.init()
self.engine.setProperty('rate', 150)
def say_song(self):
""" Tell user to choose song """
self.engine.say("Please choose song. ")
self.engine.runAndWait()
def say_alarm(self):
""" Tell user to set up the alarm """
self.engine.say("Please set up the alarm, after the beep.")
self.engine.runAndWait()
def beep(self):
self.engine.say("beep")
self.engine.runAndWait()
>>> from voices import Speech
>>> s = Speech()
>>> s.say_song()
>>> s.beep()
>>> s.say_alarm()