Skip to content

Commit 9e161cd

Browse files
authored
let the jarvis speak
added code to let the jarvis speak
1 parent 4028eb7 commit 9e161cd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

JARVIS/JARVIS.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212

1313
import speech_recognition as sr # speech_recognition Library for performing speech recognition with support for Google Speech Recognition, etc..
1414

15+
#pip install pyttsx3 # need to run only once to install the library
16+
17+
# importing the pyttsx3 library
18+
import pyttsx3
19+
20+
# initialisation
21+
engine = pyttsx3.init()
1522

1623

1724
# obtain audio from the microphone
1825
r = sr.Recognizer()
1926
with sr.Microphone() as source:
20-
print("Say something!")
27+
engine.say("Say something")
28+
engine.runAndWait()
2129
audio = r.listen(source)
2230

2331
# recognize speech using Google Speech Recognition
@@ -44,9 +52,11 @@ def get_app(Q):
4452
elif Q == "browser":
4553
subprocess.call(['C:\Program Files\Internet Explorer\iexplore.exe'])
4654
else:
47-
print("Sorry ! Try Again")
55+
engine.say("Sorry Try Again")
56+
engine.runAndWait()
57+
4858
return
4959

5060

5161
# Call get_app(Query) Func.
52-
get_app(Query)
62+
get_app(Query)

0 commit comments

Comments
 (0)