sudo apt-get install rec sudo apt-get install flac sudo apt-get install sox sudo apt-get install sed sudo apt-get install ttytter
#!/bin/bash FILEWAV="sound.wav" # FILEFLAC="sound.flac" # flac #echo "Recording from microphone..." rec -r 16000 -b 16 -c 1 $FILEWAV >/dev/null 2>&1 & echo "Tweeting this speech..." read KEYPRESSED # killall rec # flac sox $FILEWAV $FILEFLAC gain -n -5 silence 1 5 2% # wav- rm $FILEWAV echo "You said: " wget -q -U "Mozilla/5.0" --post-file $FILEFLAC --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=ru-RU&client=chromium" > test.ret cat test.ret | sed 's/.*utterance":"//' | sed 's/","confidence.*//' > test.txt rm test.ret TWITEXT="$(cat test.txt)" echo $TWITEXT ttytter -status="$TWITEXT"
Source: https://habr.com/ru/post/150317/
All Articles