File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1212
1313import 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
1825r = sr .Recognizer ()
1926with 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 )
You can’t perform that action at this time.
0 commit comments