Google's Speech Recognition from the command line
speech-rec.sh is a bash script that sends a flac audio file to Google for speech recognition and prints the N-best returned hypotheses. It uses the (until now) freely available, though up to 50 requests a day limited, Google ASR API version 2.
More interestingly, if you have
timeout) installed on your machine, you can use the script to interactively record and utterance and get its transcription.
To install sox type:
sudo apt-get install sox
For more details about Google's ASR service check out this article.
Recognize speech from audio file
./speech-rec.sh -i record.flac --rate 16000
Try other languages (default=en_US):
-l to set language:
./speech-rec.sh -i record.flac --rate 16000 --language fr_FR
./speech-rec.sh -i record.flac -r 16000 -l es_ES
./speech-rec.sh -i record.flac -r 16000 -l de_DE
Simply say something and get what you've said
This will give you 3 seconds to talk:
Talk for 7 seconds (default=3)
-d to set duration:
./speech-rec.sh -d 7
The script writes audio data into an audio file named
DATE_TIME is the output of:
To replay your utterance with
Google API Key
The key delivered with this script is to be used for test purposes only. It may be disabled by Google anytime. You should generate and use your own API key (follow this link for key generation instructions: http://www.chromium.org/developers/how-tos/api-keys)
for audio data acquistion, or
if you don't have
to send data to server.
this repository offers a Python ASR API for many vendors.
Amine SEHILI (firstname.lastname@example.org)
Copyright (C) Amine SEHILI 2015-2016.
This program is available under the GNU GENERAL PUBLIC LICENSE Version 3.
Source code on GitHub: https://github.com/amsehili/gspeech-rec.