while True:
data = stream.read(4000, exception_on_overflow=False)
if (rec.AcceptWaveform (data)) and (len(data) > 0):
voice = json.loads (rec.Result())
if voice['text']:
aud = voice['text']
yield voice['text']
for text in listen():
if text in cmd['names']:
sound()