Android Question CRGoogVR-Library, Google Voice Recog w/ source


Well-Known Member
Licensed User
I've uploaded an example B4A app for Google Voice Recognition along with its source code and Eclipse Java source code for the CRGoogVR library I developed.

I've also included my compiled APK so you can just quickly install and try out the example app, if you want.

I placed everything in a zip archive and uploaded to Dropbox - the zip file is likely too large to upload directly to the forum.

To build the CRGoogVR library I used the Simple Library Compiler (SLC) available elsewhere on these forums.

I use Eclipse mainly to take advantage of the IDE editor, Project structure, syntax checking, and tips, but it was not used to build the library. The library was actually built using the SLC.


When I run the SLC, a window similar to the above opens. The string in A points to the Eclipse Project workspace directory for the CRGoogVR library on my computer. The text field B points to where the compiled .jar and .xml files will be placed. I don't know what C does or where the string in this field came from :D.

Unless you want to make changes and compile the library, you can just:
  1. Use the Dropbox link above to download the zip file and extract the B4A code into a B4A project directory.
  2. Copy the CRGoogVR .jar and .xml files to your B4A additional libraries folder.
  3. Compile the B4A app.
  4. (or just install the included APK to your phone).
I'm still using version 4.30 of B4A so you might see a warning when you open the B4A example with a later version. Everything should work, however.

Here's a screenshot of the executing demo B4A app.


  • Click on the Start button and wait for the green "recording" status message. The default Google Speech Input dialog is not displayed.
  • The microphone will capture audio, send it to the Google Speech Recognition API, and the text VR is shown.
  • End of speech will be automatically detected, but you can use the Stop button to end things early.
  • Both interim partial results (pre-pended with PR: ) and the final result (pre-pended with FR: ) are displayed.
  • The Rectangular field toward the upper right will show the microphone RMS value.
This library is similar to my CRBingVR library, but uses the Google Speech API rather than the Microsoft Cognitive Services speech API.

I think the Microsoft API recognizes speech a little better, but the Google API does not require an account or "Key" (or charge a fee) to use their API.



  • upload_2017-2-24_20-7-4.png
    31.3 KB · Views: 319
Last edited:


Well-Known Member
Licensed User
As far as I can tell the Google version (CRGoogVR, actually uses the Android API) does not allow you to send audio data – that would include wave files, data captured directly from the microphone, or some other streaming audio source.

It handles the audio input from the microphone, detecting start/stop of speech, no-speech-detected, and I believe does noise suppression.

Upvote 0

Syd Wright

Well-Known Member
Licensed User
Nice job. It is apparently not possible to change the recognition language and it does not offer continuous speech recognition (whereas CRBingVR3 does, but allas not in Dutch (yet)).

Your library seems to use the regular (free) Google API/SDK that is part of Android.
However, like Microsoft Bing, there also is a paid Google SR API version. It would be nice if someone could develop a library for that.
Upvote 0


Well-Known Member
Licensed User
Special thanks to Barry (CanalRun) for these libraries :)
Using them with B4a Version 8.8 and the new Google/Android requirements I have made it work with:
1. Include the RuntimePermissions library
2. Update the manifest to:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>

3. Code
Sub Activity_Create
End Sub

Sub RequestPermissions
    ToastMessageShow("Requesting permissions", False)
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
    If Permission = rp.PERMISSION_RECORD_AUDIO Then
    End If
End Sub
Thanks Barry!
Upvote 0