import pyttsx3,datetime,speech_recognition
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)# Defining Voice
def speak(audio):
engine.say(audio)
engine.runAndWait() # If You Not Write This Your Voice Will Not Work And If You Forget To Put () Brackets Your Python Program Will Crash
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 My Name Is Rohit Giri And I am Your Robot")
wishMe()
No comments:
Post a Comment