lkuza2 / java-speech-api

The J.A.R.V.I.S. Speech API is designed to be simple and efficient, using the speech engines created by Google to provide functionality for parts of the API. Essentially, it is an API written in Java, including a recognizer, synthesizer, and a microphone capture utility. The project uses Google services for the synthesizer and recognizer. While this requires an Internet connection, it provides a complete, modern, and fully functional speech API in Java.
GNU General Public License v3.0
534 stars 301 forks source link

Google cannot be contacted: getting null response #31

Closed cfecherolle closed 10 years ago

cfecherolle commented 10 years ago

Hi,

Since it has been suggested (sorry for being off-topic the other day), I'm opening my own issue about a connectivity problem I'm encountering with Google servers.

Here is what I'm woking with:

I've mostly tried step-by-step debugging on the "rawRequest" method in Recognizer.java, to see if it came from the request building part (especially when encoding FLAC data), still no clue.

1) The built request URL is the following (nothing fancy here, I just kept default parameters) : https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US&maxresults=4 2) I can only guess that up to when outputStream has read fileInput data (and it is properly encoded) things are going great (but i'm not familiar with dealing with streams and HTTP requests in Java). Plus, I can see data written in outputStream.buf. 3) The part where things get wrong must be around when the BufferedReader getting the InputStream, because then I get... a null br. Also, when the response string reads this br, it becomes null.

I hope this info can help solving my case, if you need to know more about a particular point, please ask me!

As I've been told recently, even if Google has in the meantime (silently) released a v2 of its speech API, the "old" one should still work, so I'm really clueless now, after trying a few hours to understand why my attempts keep failing.

Any hints or help would be greatly appreciated :)

cfecherolle commented 10 years ago

Okay so: it appears that I just made a dumb mistake. Forgot to check how the input recording + encoding was doing, it happens that it was terrible (microphone issues + wrong encoding parameters on my side). I've managed to correct it and it's working. I'm just leaving this "issue" here so if anyone else comes across non-logical null responses, they may have the same kind of problem.

Solved! Sorry for bothering. Thanks again for the fantastic GUI example + hello world, very useful.

Anmolgit commented 9 years ago

@cfecherolle sir, i am also getting the exact same problem. can you please tell me what changes you made? It will be a great Help! Thanks.

Skylion007 commented 9 years ago

The V1 API endpoint is deprecated. Please use the Duplex or RecognizerV2 class instead.