1
0
mirror of https://github.com/MarkParker5/STARK.git synced 2025-07-12 22:50:22 +02:00

small fix

This commit is contained in:
MarkParker5
2021-01-06 18:45:18 +02:00
parent a712713448
commit ff1e832dcc
2 changed files with 7 additions and 4 deletions

View File

@ -15,8 +15,11 @@ class SpeechToText:
this.r.dynamic_energy_threshold = False
def listen(this):
with this.m as source:
audio = this.r.listen(source)
try:
with this.m as source:
audio = this.r.listen(source)
except:
return ''
try:
responce = {'text': this.r.recognize_google(audio, language = this.language).lower(), 'status': 'ok'}
except sr.UnknownValueError:

View File

@ -18,7 +18,7 @@ if config.double_clap_activation:
# check double clap from arduino microphone module
def checkClap(channel):
global lastClapTime
global doubleClapw
global doubleClap
now = time.time()
delta = now - lastClapTime
if 0.1 < delta < 0.6:
@ -75,7 +75,7 @@ while True: # main loop
if Command.isRepeat(text):
reply(memory[0]['responce']);
continue
# recognize command with context
# trying to recognize command with context
try:
cmd, params = memory[0]['cmd'].checkContext(text).values()
if memory[0].get('params'): params = {**memory[0].get('params'), **params}