I use the REST API with cURL because I need to do something quick and simple, and I am in a box where I cannot run the trash; that is, some thick developer SDK.
I started base64 encoding flac files and started speech.syncrecognize .
As a result, this failed:
{ "error": { "code": 400, "message": "Request payload size exceeds the limit: 10485760.", "status": "INVALID_ARGUMENT" } }
So good, you cannot send 31,284,578 bytes per request; must use cloud storage. So, I upload the flac audio file and try again to use the file in Cloud Storage. This fails:
{ "error": { "code": 400, "message": "For audio inputs longer than 1 min, use the 'AsyncRecognize' method.", "status": "INVALID_ARGUMENT" } }
Great, speech.syncrecognize doesn't like the size of the content; try again with speech.asyncrecognize . This fails:
{ "error": { "code": 400, "message": "For audio inputs longer than 1 min, please use LINEAR16 encoding.", "status": "INVALID_ARGUMENT" } }
Ok, so speech.asyncrecognize can only do LPCM; upload a file in pcm_s16le format and try again. So finally, I get a manual manipulator:
{ "name": "9174269756763138681" }
Keep checking it, and in the end it ends:
{ "name": "9174269756763138681", "done": true, "response": { "@type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeResponse" } }
So wait, after the result is now in the queue, is there no REST method to request the result? Someone, please tell me that I missed the obvious look at me directly in the face, and that Google did not create a completely meaningless, incomplete, REST API.