seicaratteri seicaratteri - 1 year ago 87
Java Question

JAVA using google speech recognition API

I'm trying to use google speech recognition API. Here's the code i've written:

It works. I get an answer from the server:


Now the problem is "status:5". Infact, here's status code:

status: 0 – correct
, status: 4 – missing audio file, 
status: 5 – incorrect audio file.

My problem is "incorrect audio file". I don't understand if it is a .flac file error (you can download my test .flac file here: or how i read the file (in a byte array then convert it into string)

Thanks for help! and sorry for my bad english

Answer Source

You must use wr.write(data); instead of wr.writeBytes(new String(data));

Google answer:

{"status":0,"id":"e0f4ced346ad18bbb81756ed4d639164-1","hypotheses":[{"utterance":"hello how are you","confidence":0.94028234},{"utterance":"hello how r you"},{"utterance":"hello how are u"},{"utterance":"hello how are you in"}]}