View source for Google Voice Recognition
From Openmoko
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page:
Template used on this page:
Return to Google Voice Recognition.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page:
Template used on this page:
Return to Google Voice Recognition.
Convert an Audio-File into text file via voice recognition.
NOTE: The shell script mentioned below can be used on any Linux-Operating System with some software requirements, because the speech recognition is not performed on the local machine. |
Because the performance of your Freerunner is too poor for voice recognition, the Google Voice API can be used to convert a recorded Audio file into a text file. Be aware that the audio file will be transmitted to Google and the recognition is not performed on your FR. This implies, that you need to have Internet access on your freerunner FR to submit the audio file.
NOTE: You must be aware of the fact, that the follow script is running on your freerunner but it is not a standalone voice recognition software and so you might not want to use this tool for private audio files. |
For using the Google Voice API and the script you need to have the following package installed on your freerunner:
Install the packages from the repositories of the freerunner Distributions.
NOTE: The return code of German audio files needs capitalization of nouns, because all words are return in small caps. A ispell or aspell correction of the message.txt might improve the recognized text. |
The script code googlevoice.sh can be tested on any Linux machine with SoX, SED, WGET installed. Modifiy the script according to your demands and storage of your audio files
#!/bin/sh echo "1 SoX Sound Exchange - Convert WAV to FLAC with 16000" sox message.wav message.flac rate 16k echo "2 Submit to Google Voice Recognition" wget -q -U "Mozilla/5.0" --post-file message.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=de-de&client=chromium" > message.ret echo "3 SED Extract recognized text" cat message.ret | sed 's/.*utterance":"//' | sed 's/","confidence.*//' > message.txt echo "4 Remove Temporary Files" rm message.flac rm message.ret echo "5 Show Text " cat message.txt
The parameter lang=de-de is indicating, that the Google Voice API is expecting a German language audio file. Replace lang=de-de by lang=en-us to submit an audio file in US-English.
The script googlevoicepar.sh with a command line parameter can be used if you want to use multiple input files for batch file recognition. You will call this script with the basename e.g. message0, message1,... by
#!/bin/sh LANGUAGE="de-de" echo "1 SoX Sound Exchange - Convert $1.wav to $1.flacC with 16000" sox $1.wav $1.flac rate 16k echo "2 Submit to Google Voice Recognition $1.flac" wget -q -U "Mozilla/5.0" --post-file $1.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=${LANGUAGE}&client=chromium" > $1.ret echo "3 SED Extract recognized text" cat $1.ret | sed 's/.*utterance":"//' | sed 's/","confidence.*//' > $1.txt echo "4 Remove Temporary Files" rm $1.flac rm $1.ret echo "5 Show Text " cat $1.txt
As mentioned above is speech recognition will not be performed on your Freerunner, the audio file will be submitted to a remote server and the the remote server will return an XML-File with info on accuracy and the recognized text. To compare the performance with a standalone speech recognition software, you have to test that on a Linux Box (e.g. Ubuntu)
sudo add-apt-repository ppa:grasch-simon-listens/simon
sudo apt-get update
sudo apt-get install simon
simon
NOTE: These test might help to create a remote Speech Recognition Solution based on Julius and Simon for usage on a Freerunnner. Simon can run as server. Tests can be used to connect your freerunner to Simon. |
Google API will always need internet access like other speech recognition application for smart phones.
NOTE: Also other Speech recognition apps on Android (FlexT9) or on the iPhone (Dragon Natural Speaking for iPhone) are performing the transcription of an audio sample on the server and returning the transcript to the client mobile phone. That has to be done because of the limitations of the hardware on a mobile phone. This will improve in the future. |
In analogy to the commercial apps for the development of OpenSource standalone Software on Linux it might be good to have an OpenSource-Webinterface or an Android app to collect Audio Samples for improving the user independent Speech Recognition Profiles HMM for Speech Recognition of large vocabulary and different languages.
Google Streaming Remote Engine look over the chrome source. As you can see the javascript api work includes a separate streaming feature where there is a full-duplex Http connection. This allows a long running connection for chunking audio data on the submit side. No longer do you have to segment audio clips longer than 15 seconds as mentioned earlier. While there is more data, you just use the Http connection to write another chunk on the upload channel. The download stream returns the json containing hypotheses and utterance elements.