Text To Voice Using Python
Text To Voice Using Python
code
mport pyttsx3
import datetime
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def wishme():
hour = int(datetime.datetime.now().hour)
if hour>=0 and hour<12:
speak("good morning")
elif hour>=12 and hour<=18:
speak("good afternoon")
else:
speak("good evening")
speak("hi mehul i am your assistant. how are you")
a=input()
if a == "i am fine":
speak("it's good that you are fine ")
if __name__ == "__main__":
wishme()
Comments
Post a Comment