alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.36k stars 1.04k forks source link

Failure to create recognizer #1513

Closed Hammond2789 closed 4 months ago

Hammond2789 commented 4 months ago

I am currently using the example given. The model is created. I am using the smaller version of the English model from the website. The error gives no information.

 try (Model model = new Model("/data/models/en-us");
                 Recognizer recognizer = new Recognizer (model, 16000)) {
                int nbytes;
                byte[] b = new byte[4096];
                while ((nbytes = is.read(b)) >= 0) {
                    if (recognizer.acceptWaveForm(b, nbytes)) {
                        recognizer.getResult();
                    } else {
                        recognizer.getPartialResult();
                    }
                }
                 result = recognizer.getFinalResult();
            }
Hammond2789 commented 4 months ago

Worked after I re downloaded the model.