alphacep / alphacep/vosk-api

Androiud app crash on new Recognizer()

Open
#1,454 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
15.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Hi,
I am testing VOSK on Android and when instantiate Recognizer app crashes. I use following code:
```
private void startRecording() {
try {
Log.i("VOSK","START");
StorageService.unpack(context, "model-en-us", "model",
(tempModel) -> {
model = tempModel;
},
(exception) -> Log.e("RECORD", "model load failed " + exception));
Recognizer recognizer = new Recognizer(model, 16000.0f);
SpeechService speechService = new SpeechService(recognizer, 16000.0f);
speechService.startListening(new RecognitionListener() {
@Override
public void onPartialResult(String hypothesis) {
Log.i("VOSK", "PARTIAL RESULT: " + hypothesis);
}

@Override
public void onResult(String hypothesis) {
Log.i("VOSK", "RESULT: " + hypothesis);

}

@Override
public void onFinalResult(String hypothesis) {
Log.i("VOSK", "FINAL RESULT: " + hypothesis);

}

@Override
public void onError(Exception exception) {
Log.e("VOSK", "ERROR RESULT: " + exception);

}

@Override
public void onTimeout() {
Log.i("VOSK", "TIMEOUT");
}
});
} catch (Exception e) {
Log.e("VOSK", "Exception: " + e);
throw new RuntimeException(e);
}
```

Stack trace:
```
2023-10-27 22:32:43.429 22621-22621 VOSK com.jure.homeautomation I START
2023-10-27 22:32:43.478 22621-22621 libc com.jure.homeautomation A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x804 in tid 22621 (.homeautomation), pid 22621 (.homeautomation)
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A Cmdline: com.jure.homeautomation
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A pid: 22621, tid: 22621, name: .homeautomation >>> com.jure.homeautomation <<<
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #00 pc 0000000000404548 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk!libvosk.so (Model::Ref()+4)
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #01 pc 00000000003618ec /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk!libvosk.so (Recognizer::Recognizer(Model*, float)+88)
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #02 pc 0000000000426a34 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk!libvosk.so (vosk_recognizer_new+44)
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #03 pc 000000000001404c /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #04 pc 0000000000010a18 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #05 pc 0000000000007564 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #06 pc 0000000000011030 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk
2023-10-27 22:32:43.842 22961-22961 DEBUG pid-22961 A #07 pc 00000000000141e0 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk
2023-10-27 22:32:43.843 22961-22961 DEBUG pid-22961 A #13 pc 00000000002cf678 /data/app/~~dla-xPWnFT-z77LXvah1mA==/com.jure.homeautomation-FCmD3kpso8mf4IcKYkDIIA==/base.apk (org.vosk.Recognizer.+0)
2023-10-27 22:32:43.843 22961-22961 DEBUG pid-22961 A #18 pc 00000000000012d8 /data/data/com.jure.homeautomation/code_cache/.overlay/base.apk/classes3.dex (com.jure.homeautomation.RunnableRecord.startRecording+0)
2023-10-27 22:32:43.843 22961-22961 DEBUG pid-22961 A #23 pc 00000000000012c0 /data/data/com.jure.homeautomation/code_cache/.overlay/base.apk/classes3.dex (com.jure.homeautomation.RunnableRecord.run+0)
---------------------------- PROCESS ENDED (22621) for package com.jure.homeautomation ----------------------------
```

Another question is it possible to feed existing audio file to VOSK and get text as response?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.