Biswajit

Active Member
Licensed User
Longtime User

Biswajit

Active Member
Licensed User
Longtime User
Why are you sharing these videos? If you want to add the functionality you have to think of a solution. If you are facing a problem post that to the forum directly. I am not gonna check the code from the video and do it for you as it's not related to this library.

This is a simple example of adding space/dot when there is no speech detected by the library,
B4X:
Sub STT_PartialResult(text As String)
    If text.Trim.length > 0 Then
        partialResultBox.Text = text
        timer.Enabled = False
    Else
        If StopBtn.Enabled Then timer.Enabled = True
    End If
End Sub

Sub timer_Tick
    ''add space/dot when the partial result length is 0
    resultBox.Text = resultBox.Text & " . "
End Sub
 

Attachments

  • Screenshot_20221103-220549.jpg
    100.1 KB · Views: 125

Biswajit

Active Member
Licensed User
Longtime User
The Test-app APK file works very well! This is really great. However, I keep getting this error when implementing this speech recognizer in my app: java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-aarch64/libjnidispatch.so) Not found in resource path (.) I have found both .so files and have tried to include them in dozens of ways, including adding the entire "lib" folder from the APK file, modifying the path in jna.jar and using "#AdditionalRes: ..\lib", but nothing works. I have also read all the threads about inclusing .so files, but still I am stuck. Please help!
 

DonManfred

Expert
Licensed User
Longtime User
looks like there is no 64bit libjnidispatch.so inside the library.

they needs to be added to the library jar file into the right subfolder. Remember that the jar is a zip-file
Thanks. I tried to modify the jna.jar file (with zip) by adding the folder: android-aarch64 to: com/sun/jna/ and inserted both .so files there that I derived from the lib folder within the APK "Test App" file, but no success. PS: I also added this entire lib folder to my B4A project. The APK file works fine!
What I also find strange is that there is no reference anywhere to this jna.jar (nor to the vosk-adroid.aar) file. I guess it must be somewhere hidden in the SpeechToText.jar /xml library (?)
 
The needed .so is inside the AAR.
At least for
- arm64-v8a
- armeabi-v7a
- x86
- x86_64

What Device do you have?
Samsung Galaxy TAB S7 with Android-13. Shouldn't the AAR be added to my B4A project (or is it maybe used within the SpeechToText.jar /xml library)? Also why am I getting the afore mentioned error: java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-aarch64/libjnidispatch.so) Not found in resource path (.) which seems to ignore the AAR?
 

drgottjr

Expert
Licensed User
Longtime User
i've checked my downloads:
SpeechToText_v1.3.zip and SpeechToText_v1.4.zip (the latest, as far as i am aware) both contain all the files you need to build an app. unzip the jar and put all the files in your additional libraries folder. when you build the project, just select SpeechToText from the libraries tab in the IDE.
i've had no trouble building. see https://www.b4x.com/android/forum/threads/talk-to-the-hand-the-final-frontier.143639/#content
for a comparison between android's speech recognition capabilities and vosk's. the vosk part was built with the library right out of the box.
 
Reactions: byz
Thank you very much. Obviously I did follow all the instructions by Biswajit. The only explanation I have that it doesn't work for me is that I am still using an old B4A version (8.3). I have not done much with B4a for ages (lost interest). Sad to read that Vosk is not as good as Google. I mainly want to use Vosk for continuous speech recognition and/or to use it as a hotword detector. I was using Snowboy for that, but it doesn't work on recent Android versions.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…