The V2 API for google voice translation seems to be using the URL https://www.google.com/speech-api/v2/recognize
The output is having following characteristics
output : json. xml not supported
lang: any locale
key: Developer should get the key from Developer console
app : optional parameter . passing this returns some additional reruns values
client : is an optional parameter again, normally application seems can use chorome as value.
An Example can be given like this:
First of all, we need to have a recording utility, and that can be obtained using the folioing few commands
Install SOX
On OS X with homebreew installed,
brew install sox
Recording Audio
rec —encoding singed-integer —bits 16 —channels 1 —rate 16000 test.wav
Send the request
curl -X post —data-binary @“audio/hello.wav” —header ‘Content-Type:audio/l16;rate=16000;’ https://www.google.com/speech-api/v2/recognize?output=json&lag=en-us&key=
When google is 100% sure about the translation, the resonse is something like below
{
"result":[
{
"alternative":[
{
"transcript":"good morning Google how are you feeling today"
}
],
"final":true
}
],
"result_index":0
}
when google is unsure, the response will be something like below
{
"result":[
{
"alternative":[
{
"transcript":"this is a test",
"confidence":0.97321892
},
{
"transcript":"this is a test for"
}
],
"final":true
}
],
"result_index":0
}
References
https://github.com/gillesdemey/google-speech-v2
No comments:
Post a Comment