Another voice automation topic.. - Raspberry Pi Forums
hello, developing home information system based on raspberry.
managed create stt part of project:
main prob here cannot start script automatically using trigger..
start using voice.
ideal situation: should say: "hren" (after 2 seconds system should start script)
know examples without using dragonfly , other packages not easy configure?
managed create stt part of project:
code: select all
-*- coding: utf-8 -*- import urllib2 import json import os time import gmtime, strftime def speechtotext(): os.system( "arecord -q -d 4 -d hw:1,0 -f s16_le -c 1 -r 16000 '/home/pi/pyri/sounds/record.wav'") os.system( "ffmpeg -loglevel 0 -v 0 -i /home/pi/pyri/sounds/output.wav -ab 192k -y '/home/pi/pyri/sounds/output.flac' ") filenametmp = ('/home/pi/pyri/sounds/output.flac') url = "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium〈=ru-ru" flac=open(filenametmp,"rb").read() header = {'content-type' : 'audio/x-flac; rate=16000'} req = urllib2.request(url, flac, header) data = urllib2.urlopen(req) t=data.read() txt=t.decode('utf-8') in json.loads(txt)['hypotheses']: speechtext=i['utterance'] return speechtextstart using voice.
ideal situation: should say: "hren" (after 2 seconds system should start script)
know examples without using dragonfly , other packages not easy configure?
raspberrypi
Comments
Post a Comment