Android Question SpeechToText Library works only in English

Solution
i'm not sure i follow which part(s) of the speech to text library you are having a problem with.
i use the voice recognition part. i have no problem using language models other than english.
in fact, i have used the german model.

the large models are not for use in a smartphone. the so-called small models are what you need.

there are 2 ways to get the library to work with languages other than english. the first simply
involve changing the name of whichever language model you want to use to "model.zip". that's
what the library is looking for. of course, that means moving the current "model.zip" (the english
model) somewhere else if you want to keep it.

the second option can be a little tricky; you need to create a folder whose...

drgottjr

Expert
Licensed User
Longtime User
i'm not sure i follow which part(s) of the speech to text library you are having a problem with.
i use the voice recognition part. i have no problem using language models other than english.
in fact, i have used the german model.

the large models are not for use in a smartphone. the so-called small models are what you need.

there are 2 ways to get the library to work with languages other than english. the first simply
involve changing the name of whichever language model you want to use to "model.zip". that's
what the library is looking for. of course, that means moving the current "model.zip" (the english
model) somewhere else if you want to keep it.

the second option can be a little tricky; you need to create a folder whose name will be the
same as that of the language model you are going to use. if you put that language model's
.zip archive in there and unzip it, you should be good to go. take a look at the attached image.
my setup is a modified version of how the library's author sets up his example, but you can get
the idea from the image. each language model sits in its own folder, and the name of the folder
reflects exactly the name of the language model's zip archive.

i would recommend 2 things: change the name of your german language model to "model.zip".
that's the easiest solution. the second recommendation would be to use android's built-in
text to speech and voice recognition models. vosk is fun, but i've found android's built-in engines to
be better.
 

Attachments

  • vosk.png
    vosk.png
    156.8 KB · Views: 102
Upvote 0
Solution

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you!

I already tried renaming the models to model.zip, crashed anyway.

But your second hint helped me a lot, now I am using this:


Since I do not need continuous recognithion this is fine with me.
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
I tried both the smaller German models, renamed them to model.zip, tried release model, set bridgelogger to on ... maybe y<ou can make something of the logs?

Logger verbunden mit: samsung SM-A725F
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (activity_permissionresult)
running waiting messages (1)
Model not found
Model zip not found. Copying...
** Activity (main) Resume **
Model zip unzipping...
Unzipping Files: 1
Unzipping Files: 2
Unzipping Files: 3
Unzipping Files: 4
Unzipping Files: 5
Unzipping Files: 6
Unzipping Files: 7
Unzipping Files: 8
Unzipping Files: 9
Unzipping Files: 10
Unzipping Files: 11
Unzipping Files: 12
Unzipping Files: 13
Unzipping Files: 14
Unzipping Files: 15
** Activity (main) Pause, UserClosed = false **
** Activity (speechtotext) Create (first time) **
--------- beginning of crash
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 11512 (b4a.example), pid 11512 (b4a.example)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a72qnseea/a72q:13/TP1A.220624.014/A725FXXU4CWA2:user/release-keys'
Revision: '7'
ABI: 'arm64'
Processor: '6'
Timestamp: 2023-02-10 17:50:19.640388515+0100
Process uptime: 6s
Cmdline: b4a.example
pid: 11512, tid: 11512, name: b4a.example >>> b4a.example <<<
uid: 10433
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'terminating with uncaught exception of type kaldi::KaldiFatalError: kaldi::KaldiFatalError'
x0 0000000000000000 x1 0000000000002cf8 x2 0000000000000006 x3 0000007fc9cd44b0
x4 736f646277641f73 x5 736f646277641f73 x6 736f646277641f73 x7 7f7f7f7f7f7f7f7f
x8 00000000000000f0 x9 00000076a6b53b60 x10 0000000000000001 x11 00000076a6b936f0
x12 69646c614b3a3a69 x13 7272456c61746146 x14 00000076a6b53a52 x15 000000000000000a
x16 00000076a6bfbd70 x17 00000076a6bd7430 x18 0000000000000000 x19 0000000000002cf8
x20 0000000000002cf8 x21 00000000ffffffff x22 ffffff80ffffffc8 x23 0000007fc9cd4700
x24 0000007fc9cd45e0 x25 0000007fc9cd4620 x26 000000007fffffff x27 0000007fc9cd4e90
x28 0000007fc9cd4dd0 x29 0000007fc9cd4530
lr 00000076a6b84628 sp 0000007fc9cd4490 pc 00000076a6b84654 pst 0000000000001000
backtrace:
#00 pc 0000000000052654 /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) (BuildId: df59110c25db9843852145a266abecf7)
#01 pc 0000000000796190 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so
#02 pc 00000000007962e8 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so
#03 pc 00000000007931d8 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so
#04 pc 0000000000792804 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so
#05 pc 0000000000792760 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so (__cxa_throw+112)
#06 pc 000000000028a2a4 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so (kaldi::MessageLogger::LogAndThrow::eek:perator=(kaldi::MessageLogger const&)+112)
#07 pc 00000000002fade4 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so (Model::Model(char const*)+1208)
#08 pc 0000000000321a9c /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libvosk.so (vosk_model_new+32)
#09 pc 0000000000010154 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libjnidispatch.so
#10 pc 000000000000f938 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libjnidispatch.so
#11 pc 0000000000006e6c /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libjnidispatch.so
#12 pc 000000000000fedc /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libjnidispatch.so
#13 pc 00000000000102d0 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/lib/arm64/libjnidispatch.so
#14 pc 000000000043e154 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#15 pc 0000000000209398 /apex/com.android.art/lib64/libart.so (nterp_helper+152) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#16 pc 000000000017bec8 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (org.vosk.Model.<init>+0)
#17 pc 000000000020a254 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#18 pc 0000000000164a28 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (com.biswajit.vosk.SpeechToText.Initialize+24)
#19 pc 000000000020a254 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#20 pc 0000000000161e80 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (b4a.example.speechtotext._init+76)
#21 pc 0000000000209334 /apex/com.android.art/lib64/libart.so (nterp_helper+52) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#22 pc 0000000000161d6c /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (b4a.example.speechtotext._activity_create+48)
#23 pc 0000000000434a00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#24 pc 0000000000467134 /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::pointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1960) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#25 pc 0000000000466964 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+48) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#26 pc 00000000002f1148 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+120)
#27 pc 000000000020a2b0 /apex/com.android.art/lib64/libart.so (nterp_helper+4016) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#28 pc 000000000014667a /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (anywheresoftware.b4a.BA.raiseEvent2+182)
#29 pc 000000000020a958 /apex/com.android.art/lib64/libart.so (nterp_helper+5720) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#30 pc 00000000001636ac /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (b4a.example.speechtotext.afterFirstLayout+380)
#31 pc 000000000020a254 /apex/com.android.art/lib64/libart.so (nterp_helper+3924) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#32 pc 00000000001634e4 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (b4a.example.speechtotext.access$000+0)
#33 pc 0000000000209334 /apex/com.android.art/lib64/libart.so (nterp_helper+52) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#34 pc 0000000000161982 /data/app/~~8a6-lR4XfKfJjSCqzbNKeA==/b4a.example-6_EMtHRWVCqgJ7nsdozHOQ==/oat/arm64/base.vdex (b4a.example.speechtotext$WaitForLayout.run+138)
#35 pc 0000000000aca694 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+84)
#36 pc 0000000000ace748 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loopOnce+1032)
#37 pc 0000000000ace20c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+1148)
#38 pc 00000000007d7ed8 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.main+1480)
#39 pc 0000000000434a00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#40 pc 0000000000467134 /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::pointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1960) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#41 pc 0000000000466964 /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+48) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#42 pc 00000000002f1148 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+120)
#43 pc 0000000000a35e80 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+144)
#44 pc 0000000000a40d14 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.ZygoteInit.main+3604)
#45 pc 0000000000434a00 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+576) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#46 pc 000000000057df48 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+900) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#47 pc 00000000005f194c /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+160) (BuildId: 28c5aa8a2e8fc5df069f717d6e94f7fe)
#48 pc 00000000000c1c04 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124) (BuildId: 23f3bb39dfc9cf240e08903c83468d2f)
#49 pc 00000000000ce470 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+856) (BuildId: 23f3bb39dfc9cf240e08903c83468d2f)
#50 pc 0000000000002570 /system/bin/app_process64 (main+1304) (BuildId: df8ee709f77c2e3b9fca33b5a3ced970)
#51 pc 000000000004a7d4 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100) (BuildId: df59110c25db9843852145a266abecf7)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
Model not found
Model zip not found. Copying...
Model zip unzipping...
Unzipping Files: 1
Unzipping Files: 2
Unzipping Files: 3
Unzipping Files: 4
Unzipping Files: 5
Unzipping Files: 6
Unzipping Files: 7
Unzipping Files: 8
Unzipping Files: 9
Unzipping Files: 10
Unzipping Files: 11
Unzipping Files: 12
Unzipping Files: 13
Unzipping Files: 14
Unzipping Files: 15
** Activity (main) Pause, UserClosed = false **
** Activity (speechtotext) Create (first time) **
Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 13227 (b4a.example), pid 13227 (b4a.example)
 
Upvote 0

mojtaba.v3333

New Member
Upvote 0
Top