Reputation: 155
I have a college project and I'm developing an Android Application that acts like a translator. For normal text translation I'm using Google Cloud Translation API and I saw they have an option to translate text via speech using Google Cloud speech API. Problem is I don't have a starting point, and I didn't understand how can I use it.
So, is there an example of how can I use Google Cloud speech API from my Android application?
Upvotes: 3
Views: 15687
Reputation: 13
There are some key differences between Android Speech API and Google Cloud Speech API though. While the Android Speech API is free, it is limited to short phrases and is unable to process audio from files. Each speech recognition also starts and ends with a distinctive beep so the user is aware that the microphone is in listening mode - kind of a Google way to prevent writing a spoofing app, when the speech recognizer runs in the background and sends the transcript to the backend server. These limitations are lifted for Google Cloud Speech, but the integration with Android is almost non-existent. While there is an Android demo project, adapting it to yours won't be easy and one will face multiple challenges and error resolutions. And here is what Google states on their website:
Note: Cloud Java client libraries do not currently support Android.
Upvotes: 0
Reputation: 6373
Yes it is possible, I have done it, based on Googles "speech" example inside "android-docs-samples-master" (google and download those samples). Things you need to know:
UPDATE: If you got this working, you might have noticed that the 3rd or 4th time you do ASR, it fails. This is because the sample code is not designed to close and open the entire ASR recognizer properly. I got it working, if you need help on a specific error let me know. This is a summarized guide, if you need more details on a particular step let me know.
Upvotes: 0
Reputation: 25220
Android runs Java examples just fine. You can find them on github.
You can also use Android Speech API, it is free, unlike Google Cloud Speech API.
Upvotes: 3