Aug 17, 2017 Replies: 11 The ability of resumable subs to return values (added in B4A v7.3) makes it very simple to add voice recognition to your app. Code: Code: Copy Private Sub RecognizeVoice As ResumableSub vr.Listen Wait For vr_Result (Success As Boolean, Texts As List) If Success And Texts.Size > 0 Then Return Texts.Get(0) End If Return "" End Sub You can call it like this: Code: Copy Wait For (RecognizeVoice) Complete (Result As String) Example: Code: Copy Sub Activity_Click Wait For (RecognizeVoice) Complete (Result As String) If Result <> "" Then Activity.Title = Result End If End Sub Example is attached. Attachments vr.zip vr.zip 6.7 KB · Views: 4,456 Click to expand...
The ability of resumable subs to return values (added in B4A v7.3) makes it very simple to add voice recognition to your app. Code: Code: Copy Private Sub RecognizeVoice As ResumableSub vr.Listen Wait For vr_Result (Success As Boolean, Texts As List) If Success And Texts.Size > 0 Then Return Texts.Get(0) End If Return "" End Sub You can call it like this: Code: Copy Wait For (RecognizeVoice) Complete (Result As String) Example: Code: Copy Sub Activity_Click Wait For (RecognizeVoice) Complete (Result As String) If Result <> "" Then Activity.Title = Result End If End Sub Example is attached.
jimmyF Active Member Licensed User Longtime User Aug 17, 2017 #2 Thank you! This is excellent and just what I was looking for.
rtek1000 Active Member Licensed User Longtime User Dec 18, 2017 #3 When it fails to recognize the voice, it prompts the user to try again by clicking on the button in the dialog. How to abort it?
When it fails to recognize the voice, it prompts the user to try again by clicking on the button in the dialog. How to abort it?
Erel B4X founder Staff member Licensed User Longtime User Dec 18, 2017 #4 Please start a new thread for this question.
Beja Expert Licensed User Longtime User Dec 21, 2017 #5 When starting new question as advised by Erel, I suggest that people leave a link to the new thread so it can easily be found and followed.
When starting new question as advised by Erel, I suggest that people leave a link to the new thread so it can easily be found and followed.
DonManfred Expert Licensed User Longtime User Dec 23, 2017 #6 Beja said: it can easily be found and followed Click to expand... https://www.b4x.com/android/forum/threads/offline-continuous-speech-recognition-xml.87400/
Beja said: it can easily be found and followed Click to expand... https://www.b4x.com/android/forum/threads/offline-continuous-speech-recognition-xml.87400/
Y ykucuk Well-Known Member Licensed User Longtime User Feb 8, 2019 #7 hi, it doesn't work with a tablet with android 8.1 Error Code: Copy onActivityResult: wi is null
Erel B4X founder Staff member Licensed User Longtime User Feb 10, 2019 #8 Are you running the example as-is? What do you see when you click on the activity?
Y ykucuk Well-Known Member Licensed User Longtime User Feb 10, 2019 #9 Erel said: Are you running the example as-is? What do you see when you click on the activity? Click to expand... i used an example project. Nothing happened. Any of dialogs cant appear. I checked log the error is Code: Copy onActivityResult: wi is null
Erel said: Are you running the example as-is? What do you see when you click on the activity? Click to expand... i used an example project. Nothing happened. Any of dialogs cant appear. I checked log the error is Code: Copy onActivityResult: wi is null
Erel B4X founder Staff member Licensed User Longtime User Feb 11, 2019 #10 Can you post the full logs? Maybe the process is being killed at some point.
Beja Expert Licensed User Longtime User Mar 17, 2021 #11 Erel said: The ability of resumable subs to return values (added in B4A v7.3) makes it very simple to add voice recognition to your app. Code: Code: Copy Private Sub RecognizeVoice As ResumableSub vr.Listen Wait For vr_Result (Success As Boolean, Texts As List) If Success And Texts.Size > 0 Then Return Texts.Get(0) End If Return "" End Sub You can call it like this: Code: Copy Wait For (RecognizeVoice) Complete (Result As String) Example: Code: Copy Sub Activity_Click Wait For (RecognizeVoice) Complete (Result As String) If Result <> "" Then Activity.Title = Result End If End Sub Example is attached. Click to expand... Hi Erel, Is it possible that I can use a language for recognition other than English? Thank you. -B
Erel said: The ability of resumable subs to return values (added in B4A v7.3) makes it very simple to add voice recognition to your app. Code: Code: Copy Private Sub RecognizeVoice As ResumableSub vr.Listen Wait For vr_Result (Success As Boolean, Texts As List) If Success And Texts.Size > 0 Then Return Texts.Get(0) End If Return "" End Sub You can call it like this: Code: Copy Wait For (RecognizeVoice) Complete (Result As String) Example: Code: Copy Sub Activity_Click Wait For (RecognizeVoice) Complete (Result As String) If Result <> "" Then Activity.Title = Result End If End Sub Example is attached. Click to expand... Hi Erel, Is it possible that I can use a language for recognition other than English? Thank you. -B
Erel B4X founder Staff member Licensed User Longtime User Mar 18, 2021 #12 Yes, but please start a new thread for this question.