Jarvis
Jarvis
engine = pyttsx3.init('sapi5')
voices
=engine.getProperty('voices')
#print(voices[0].id)
engine.setProperty('voice',voices
[1].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("I am your assistant
saaar How may i help you? ")
def takeCommand():
r =sr.Recognizer()
with sr.Microphone() as
source :
print("Listening...")
r.pause_threshold =1
r.energy_threshold=4000
audio=r.listen(source)
try :
print("Recognizing...")
query=r.recognize_google(audio,La
nguage='en-in')
print(f"User said
{query}\n")
except Exception as e:
# print(e)
if __name__ == '__main__':
speak("...")
wishme()
takeCommand()