I have running a Python script on an Android phone.
Recognize the voice continuously and send it by socket to a Raspberry and from there to the sensors and everything else.
When you do not interpret a word, ask to try again but you have to manually start it.
I use the Google Voice Recognition brought by Android devices.
Does anyone know how to make detection not stop when there is an error?
import android
dr=android.Android()
sp=dr.recognizeSpeech('>',None,None)
txt=sp[1]
print txt
This part is blocked when there is a coding error.
To use it offline, download the language to the mobile. So I'm implementing it for now:
import sl4a
import time, socket
dr=sl4a.Android()
svr=('192.168.18.7',55565)
while True:
fra=dr.recognizeSpeech('#',None,None)
try:
txt=fra.result.lower()
except:
txt='err'
print (txt)
s=socket.create_connection(svr)
s.sendall(txt.encode('utf-8')
s.close()
time.sleep(3)
if 'fin'in txt:
break
This way I send the voice commands to raspberry, although it works for anything. The problem is that detection is not 100% continuous. Help ...