Picovoice / porcupine

On-device wake word detection powered by deep learning
https://picovoice.ai/
Apache License 2.0
3.77k stars 499 forks source link

Java init fails on Linux mint #686

Closed Blu3Lif3 closed 2 years ago

Blu3Lif3 commented 2 years ago

Im trying to create an home assistant with a laptop x86_64 running Raspberry Os. Of I try to run my code i get this Error: ai.picovoice.porcupine.PorcupineIOException: Initialization failed. at ai.picovoice.porcupine.Porcupine.init(Native Method) at ai.picovoice.porcupine.Porcupine.<init>(Porcupine.java:61) at ai.picovoice.porcupine.Porcupine$Builder.build(Porcupine.java:262) at de.VoiceRecognition.ball.WakeWordDetection.main(WakeWordDetection.java:79)

this is my code:

`

        ByteArrayOutputStream outputStream = null;

        String Keypath =   "voiceTickets/de_linux_v2_1_0.ppn";
        String ModelPath = "voiceTickets/porcupine_params_de.pv";

        // get audio capture device

        try {
            micDataLine = mic.getTargetDataLine();
            micDataLine.open(format);
        } catch (LineUnavailableException e) {
            System.err.println("Failed to get a valid capture device. Use --show_audio_devices to " +
                    "show available capture devices and their indices");
            System.exit(1);
            return;
        }

            Porcupine handle = new Porcupine.Builder()
                                .setAccessKey(accessKey)
                                .setKeywordPath(Keypath)
                                .setModelPath(ModelPath)
                                .build();`

Thank You

ksyeo1010 commented 2 years ago

Based on the error, it seems that the path you provided for the ModelPath or Keypath is incorrect. Can you make sure those are correct paths? Also, If you run the program, you can see a more detailed error message in the console describing your issue.

Blu3Lif3 commented 2 years ago

Above the error appears when I stop the code a green text [INFO] Porcupine model path: 'voiceTickets/porcupine_params_de.pv' [INFO] Porcupine keyword path[0]: 'voiceTickets/de_linux_v2_1_0.ppn [INFO] Porcupine sensitivity[0]: 0,50

Blu3Lif3 commented 2 years ago

I switched now to linux mint x86_64, getting the same Error

Blu3Lif3 commented 2 years ago

My system is

uname -a Linux 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

kenarsa commented 2 years ago

@Blu3Lif3 does these files exist?

[INFO] Porcupine model path: 'voiceTickets/porcupine_params_de.pv'
[INFO] Porcupine keyword path[0]: 'voiceTickets/de_linux_v2_1_0.ppn

I think the path to them might be incorrect. You can test it yourself with something like .exists()

Blu3Lif3 commented 2 years ago

I've tried it with: `
String ModelPath = "voiceTickets/porcupine_params_de.pv"; String Keypath = "voiceTickets/Karla_de_windows_v2_1_0.ppn";
// get audio capture device

        File Model = new File(ModelPath);
        File Key = new File(Keypath);

        if(Model.exists()) {
            System.out.println("Model exists");
        }else {
            System.out.println("No Model!");

        }
        if(Key.exists()) {
            System.out.println("KEy exists");
        }else {
            System.out.println("No KEy!");

        }`

The result: both exists

kenarsa commented 2 years ago

@Blu3Lif3 thank you! OK. The next I think we can do to help me out is to try to reproduce the same issue using one of the official Java demos. Can you please give it a try? Essentially I want to see if you can run the demo on your system as is successfully and if yes can you replace your model/keyword file and still have it working. I can help out more after learning about the outcome. keep me posted.

Blu3Lif3 commented 2 years ago

Thank you for ur help and advices. I will try it tomorrow because im ill. I will give u an update! 🙌 appreciate it man

Blu3Lif3 commented 2 years ago

@kenarsa Hey I have tried it now and I am getting this Error: oem:~/Desktop/demo/java/build/libs$ java -jar porcupine-mic-demo.jar -a [CODE] -k porcupine [INFO] Porcupine model path: '/tmp/porcupine-mic-demo/porcupine/lib/common/porcupine_params.pv' [INFO] Porcupine keyword path[0]: '/tmp/porcupine-mic-demo/porcupine/resources/keyword_files/linux/porcupine_linux.ppn' [INFO] Porcupine sensitivity[0]: 0,50 ai.picovoice.porcupine.PorcupineActivationException: Initialization failed.

kenarsa commented 2 years ago

Hmmm ... that means that the engine cannot verify your AccessKey. Do you have an internet connection? I am assuming you replaced [CODE] with your own AccessKey from Console?

Blu3Lif3 commented 2 years ago

Yes of course I've replaced it, I just didnt want others to know my key so i censored it. I have a constant internet connection 400mb. What am I supposed to do next?

kenarsa commented 2 years ago

do you mind sending your AccessKey to me so we can debug it on our side? hello@picovoice.ai

Blu3Lif3 commented 2 years ago

Yes Thank You ! :)

kenarsa commented 2 years ago

can you please give it another try?

Blu3Lif3 commented 2 years ago

can you please give it another try?

Yess give me a minute

Blu3Lif3 commented 2 years ago

can you please give it another try?

I've tried it

kenarsa commented 2 years ago

? did it work...

Blu3Lif3 commented 2 years ago

No unfortunately not, Im getting the same Output in the Console

kenarsa commented 2 years ago

I checked the server-side and everything looked good! Trying to brainstorm here ... Is your OS standard Ubuntu?

Blu3Lif3 commented 2 years ago

Its the new linux mint :)

kenarsa commented 2 years ago

Got it! Any chance you can give it a try on standard Ubuntu? I am thinking if that makes a difference then at least I know what might break the process and help with debugging. thank you in advance :)

Blu3Lif3 commented 2 years ago

Yess i will Try it later no problem. I will write you when Im done, Thank You :)

Blu3Lif3 commented 2 years ago

Im now home i will try it on my Desktop PC with ubuntu, i hope this doesnt make any difference

Blu3Lif3 commented 2 years ago

I've run it via Ubuntu Standard with my Desktop PC!

kenarsa commented 2 years ago

OK. So it runs successfully on Ubuntu standard but not on mint? Can you please confirm? If that is the case then I can start debugging it there.

Blu3Lif3 commented 2 years ago

Yes correct it runs on Ubuntu standard but not on mint

kenarsa commented 2 years ago

Great. I changed the title to reflect the root cause and I will get someone to work on this. Aiming for a solution in the coming weeks.

Blu3Lif3 commented 2 years ago

Thank you man! Have a good one

Blu3Lif3 commented 2 years ago

Could you recommend me any linux system apart from the ubuntu standard system for the ai?

laves commented 2 years ago

@Blu3Lif3 - we just tried on Linux Mint 20.3 (Cinnamon Edition) and the Porcupine Java demo is working. At this point, we may have to close this issue based on our inability to reproduce. If you have any unusual settings/configuration on the Mint system you encountered the error on, let us know and we can try again.

Blu3Lif3 commented 2 years ago

Okay Thank you! May it be a problem that the CPU of the laptop is 64 bit with an 32 efi?

laves commented 2 years ago

That definitely could create problems as the Linux binary is 64-bit only. That would be a configuration I'm comfortable saying that we don't support at this time. I'm going close this issue for now since we can't reproduce and/or do not support the machine configuration in question.

laves commented 2 years ago

@Blu3Lif3 we were finally able to narrow down the cause of this issue and put in a fix for it. Your laptop that was encountering the error should now work for you.

laves commented 2 years ago

I'm reopening this issue so that you can confirm the fix and close it once you've confirmed.

laves commented 2 years ago

Closed due to inactivity