File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import speech_recognition as recogniter
2+ import VoiceEngine
3+ import sys
4+
5+ listener = recogniter .Recognizer ()
6+ header = {'User-Agent' :'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0' }
7+ output = ""
8+
9+
10+ def getinput ():
11+ command = "null"
12+ try :
13+ with recogniter .Microphone () as source :
14+ print ("Ready For Commands" )
15+ voice = listener .listen (source )
16+ command = listener .recognize_google (voice )
17+ command = str (command ).lower ()
18+ print (command )
19+ VoiceEngine .say (command )
20+
21+ if command == "stop" :
22+ #stop_event.set()
23+ pass
24+ elif command == "exit" or command == "kill" or command == "end process" :
25+ VoiceEngine .say ("Shutding Down" )
26+ sys .exit ()
27+
28+ except Exception as e :
29+ pass
30+
31+ if command is not None and command != "null" :
32+ return str (command ).lower ()
33+ else :
34+ getinput ()
You can’t perform that action at this time.
0 commit comments