Skip to content

Added jarvis virtual assistant #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions jarvis virtual assistant
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import pyttsx3
import speech_recognition as sr

import datetime

engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
# print(voices)
engine.setProperty('voice', 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("I am jarvis hello sir tell me what to do")

def takeCommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print("listening...")
r.pause_threshold = 1
audio = r.listen(source)

try:
print("Recognizing...")
query = r.recognize_google(audio, language='en-in')
print("user said:", query)

except Exception == e:
print("say that again please..")
return "none"
return query


if __name__ == "__main__":
wishMe()
takeCommand()