使用google语音识别API的JAVA

使用google语音识别API的JAVA,java,api,speech,Java,Api,Speech,我正在尝试使用谷歌语音识别API。以下是我编写的代码: 它起作用了。我从服务器得到一个答案: {"status":5,"id":"8803471b14a2310dfcf917754e8bd4a7-1","hypotheses":[]} 现在的问题是“状态:5”。事实上,以下是状态代码: status: 0 – correct
, status: 4 – missing audio file, 
status: 5 – incorrect audio file. 我的问题是“音频文件不正确”

我正在尝试使用谷歌语音识别API。以下是我编写的代码:

它起作用了。我从服务器得到一个答案:

{"status":5,"id":"8803471b14a2310dfcf917754e8bd4a7-1","hypotheses":[]}
现在的问题是“状态:5”。事实上,以下是状态代码:

status: 0 – correct
, status: 4 – missing audio file, 
status: 5 – incorrect audio file.
我的问题是“音频文件不正确”。我不知道这是否是一个.flac文件错误(您可以在此处下载我的test.flac文件:),或者我如何读取该文件(在字节数组中,然后将其转换为字符串)


谢谢你的帮助!对不起,我的英语不好

你必须使用
wr.write(data)而不是
writeBytes(新字符串(数据))

谷歌回答:

{"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"}]}