{"status":0,"id":"37h03bf4efe17fa76594732d6dokf3-1","hypotheses":[{"utterance":" ","confidence":0.75936891}]}
#!/bin/bash echo " ..." arecord -d 3 -q -f cd -r 16000 speech.wav # speech.wav 3 16 echo " " sox speech.wav speech.flac gain -n -5 silence 1 5 2% # speech.wav speech.flac rm speech.wav # speech.wav, .. echo " ..." wget -q -U "Mozilla/5.0" --post-file speech.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=ru-RU&client=chromium" > all.ret # Google speech.flac all.ret rm speech.flac # speech.flac, .. cat all.ret | sed 's/.*utterance":"//' | sed 's/","confidence.*//' > text.txt # utterance text.txt cat all.ret | sed 's/.*confidence"://' | sed 's/}]}.*//' > confidence.txt # confidence confidence.txt rm all.ret # all.ret, .. TEXT="$(cat text.txt)" # TEXT text.txt CONFIDENCE="$(cat confidence.txt)" # CONFIDENCE confidence.txt rm text.txt # text.txt, .. rm confidence.txt # confidence.txt, .. echo $TEXT # TEXT echo $CONFIDENCE # CONFIDENCE
sudo apt-get install lame
sudo apt-get install sox
sudo chmod 755 speech.sh
./speech.sh
Source: https://habr.com/ru/post/157333/
All Articles