MCPcopy Index your code
hub / github.com/geekcomputers/Python / takecommand

Function takecommand

JARVIS/JARVIS_2.0.py:125–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123
124# obtain audio from the microphone
125def takecommand():
126 # it takes user's command and returns string output
127 wishme()
128 r = sr.Recognizer()
129 with sr.Microphone() as source:
130 print("Listening...")
131 r.pause_threshold = 1
132 r.dynamic_energy_threshold = 500
133 audio = r.listen(source)
134 try:
135 print("Recognizing...")
136 query = r.recognize_google(audio, language="en-in")
137 print(f"User said {query}\n")
138 except Exception:
139 print("Say that again please...")
140 return "None"
141 return query
142
143
144# for audio output instead of print

Callers 1

JARVIS_2.0.pyFile · 0.70

Calls 1

wishmeFunction · 0.70

Tested by

no test coverage detected