c# - Google Cloud Speech response always empty error -
i sending audio gcs, via "https://speech.googleapis.com/v1/speech:recognize?key=<my key>"
, following way:
byte[] audiobytes = g_npcaudiolistener.getaudioclipmonodata16(88200); string jsondata = "{" + "\"config\": {" + "\"encoding\": \"linear16\"," + "\"sampleratehertz\": 48000," + "\"languagecode\": \"en-us\"" + "}," + "\"audio\": {" + "\"content\" : \"" + convert.tobase64string(audiobytes) + "\"" + "}" + "}"; byte[] postdata = system.text.encoding.utf8.getbytes(jsondata); g_npccontroller.debug("sending google: " + jsondata); using (www req = new www(g_google_speech_url, postdata, g_jsonheaders)) { yield return req; if (req.error == null) { g_npccontroller.debug(req.text.replace("\n", "").replace(" ", "")); } else { string msg = convert.tostring(req.bytes); g_npccontroller.debug("google speech error: " + req.error + "\n - error: " + req.text); } }
everything specification, however, keep getting nothing error flag empty body.
while working on main json impl, getting "invalid parameter" , such... streaming 88200 chunks of 16-bit uncompressed audio bytes, keep getting error no text attached - not code. did come across similar situation?
if relevant, audio audioclip in unity, convert 32-bit float[] byte[originalaudio.length * sizeof(float)] , base64 required.
thanks.
Comments
Post a Comment