B4A Library SpeechRecognitionNoUI - Google Speech Recognition Without Popup

Hello
thank you
I tried this library and sample on two friends. Works on Samsung phone without any problems, but does not work on Lenovo Android 7 tablet. There is no response when the volume button is pressed at the bottom of the page, but on this device the speech engine works perfectly on Google's own text.
where is the problem from?
 

free2end

Member
Licensed User
Hi, Biswajit
many thanks for your effort!

1. PartialResults (Texts As List): always have only one item with all the spoken words spaced.
2. StopListening As String: please give an example of syntax
3. BufferReceived(buffer() As Byte): please give an example of syntax

best wishes!
 

Biswajit

Active Member
Licensed User
Longtime User
1. you have to set partial result = true then starting the listerner StartListening("en_US", true, false)
2. call this if you want to stop the listener just like sr.StopListening
3. there is no guarantee that this method will be called. (As per the Android documentation)
 

free2end

Member
Licensed User
1. you have to set partial result = true then starting the listerner StartListening("en_US", true, false)
allready done it but at PartialResults (Texts As List): always have only one list item with all the spoken words spaced... not a List with the recognized words as seperate items
 

Biswajit

Active Member
Licensed User
Longtime User
allready done it but at PartialResults (Texts As List): always have only one list item with all the spoken words spaced... not a List with the recognized words as seperate items

PartialResults doesn't mean you will get all the words separately.

Check the android documentation for better understanding.
 

Dave O

Well-Known Member
Licensed User
Longtime User
Ideally I'd like to be able to do speech to text and also save the voice recording. This isn't possible with XSpeechRecognizer (because of a Google limitation for Android 4.1 and later?), but wondering if this library offers anything extra that way?

Thanks.
 

Biswajit

Active Member
Licensed User
Longtime User
No. This is actually not a custom voice recognition library. It's a bridge between your app to the inbuilt android speech recognizer.
 

brown8

New Member
Hi! I'm trying to use this great library, but I'm getting some problems when I set target Sdk version to 30 (as Google demands). When I run the app, it simply doesn't do anything if I try to use the recognition and I get the log "Speech Recognition Not Available", but only with Sdk set to 30. If I change it to 29, everything works like a charm. Do you know what can I do to solve this issue?
 

Biswajit

Active Member
Licensed User
Longtime User
For Android 11 (SDK 30) you have to add the below code to your manifest for speech recognition.

B4X:
AddManifestText(
<queries>
    <intent>
        <action android:name="android.speech.RecognitionService" />
    </intent>
</queries>)
 

brown8

New Member

Thank you very much! Solved with your code.
 

Biswajit

Active Member
Licensed User
Longtime User
Don't take Spanish Words
Use "es-US" instead of "en-US" for Spanish language.
B4X:
sr.StartListening ("es-US", true, false)

You can find the IETF language tag list here.
 

Guenter Becker

Active Member
Licensed User
Dear Biswajit
I am using your lib on a Huawei p20Pro and Android API 29. It is working good except if I am setting StartListening PREFER_OFFLINE Parameter to TRUE. sr_error reports the message "no match". Whats going wrong? Any Idea. Thank you for your help.

Start Listening:
If sr.IsInitialized Then
      'Language, Partial Results, Offline
       sr.StartListening("de",True,True)
End If
 

Biswajit

Active Member
Licensed User
Longtime User
If you are using offline speech recognition then make sure you have the correct language pack installed.
 

Guenter Becker

Active Member
Licensed User
If you are using offline speech recognition then make sure you have the correct language pack installed.

Ok, understood sorry this is my first time using the lib.
Question: where will the language pack come from? In my current understanding it should be part of the android system installed on my smartphone. Do I have to download it from Google?
Are you able to help me with an download link and some help how to install please?
 

Biswajit

Active Member
Licensed User
Longtime User
  1. Open Google App
  2. click on the "more" button at the bottom right corner
  3. goto settings
  4. goto voice
  5. click on offline speech recognition
  6. goto All tab
  7. click on the language pack you want to use for offline speech recognition.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…