Android Question Porcupine hotword creation

Multiverse app

Active Member
Licensed User
Longtime User
Porcupine is a hotword recognition tool, like "Ok Google" and "Alexa". The library created by donmanfred works very well with predefined hotwords.

But when I tried creating my own hotword the library fails to initialize.
I am using Windows, and this is the command-
B4X:
E:\porcupine\pv_porcupine_optimizer -r E:\porcupine -w "extreme" -p windows -o E:\porcupine

in "E:\porcupine" directory, I have the following files-
porcupine.data
params.pv
pv_porcupine_optimizer.exe

I placed the generated "extreme_windows.ppn" file under "File.DirRootExternal&"/porcupine" folder. When run, the following error occurs:

B4X:
Error occurred on line: 48 (Main)
ai.picovoice.porcupinemanager.PorcupineManagerException: ai.picovoice.porcupine.PorcupineException: java.lang.IllegalArgumentException: Initialization of Porcupine failed.
    at ai.picovoice.porcupinemanager.PorcupineManager.<init>(PorcupineManager.java:110)
    at de.donmanfred.Porcupinewrapper.Initialize(Porcupinewrapper.java:63)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5265)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697)
Caused by: ai.picovoice.porcupine.PorcupineException: java.lang.IllegalArgumentException: Initialization of Porcupine failed.
    at ai.picovoice.porcupine.Porcupine.<init>(Porcupine.java:49)
    at ai.picovoice.porcupinemanager.PorcupineManager.<init>(PorcupineManager.java:108)
    ... 20 more
Caused by: java.lang.IllegalArgumentException: Initialization of Porcupine failed.
    at ai.picovoice.porcupine.Porcupine.init(Native Method)
    at ai.picovoice.porcupine.Porcupine.<init>(Porcupine.java:47)
    ... 21 more
** Activity (main) Resume **


My example code- https://drive.google.com/open?id=1qEmR9kVJ2sHqk575UW8W0ZRc6PrzZHpN
I've attached the generated hotword.
 

Attachments

  • extreme_windows.zip
    220 bytes · Views: 353
Last edited:

DonManfred

Expert
Licensed User
Longtime User
As far i can help (unfortunately the lib still does not work for me).

I found out that the files generated by the Windowstool seems to be not able to create Files for ANDROID!?

Now i found this (Optimizer/readme.md)

So, if you need to create keywords for Android you need to buy a License. Don´t know what it costs/how much it is. You need to contact contact@picovoice.ai
 
Last edited:
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Hi. Can you tell us more about this wonderful library?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Can you tell us more about this wonderful library?
It is a wrap for this Github project.

Keywords available:
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I was HELPFUL with this library too! I DID WROTE IT
I don´t care about the 5 minutes you was too lazy to build the example by yourself.
I deciced NOT to react on Posts from you. Private or open.

Thank you. I don't have the skills to develop a B4A project on the basis of just a JAR, XML and some RAW data. If you don't have the time to make a test project I have no other choice than to let it rest (i.e. no donation, sorry).

Please do not ask me about any Library anymore.
 
Last edited:
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Hi Don

it is a shame not to share your work , maybe into a donationware formula .

Or send me Pm with your price .

Think about it , the voice commands are the new future and do it with B4A will be great !!
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You are not able to create new commands with this library. At least not for Android. You need a Commercial License for this.
Additionally the lib still does not work for me. Maybe my Device (Android 8). I don´t know.
I would feel bad if i release it.
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Many thanks for your reply , it is a shame !

I will continue trying to understand Google action command
 
Upvote 0

Multiverse app

Active Member
Licensed User
Longtime User
It worked fine on my Android 8 device
What issue are you facing?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
What issue are you facing?
The initialization does work (i guess). in resume i start and when i try to activate the Keyword used (Alexa_Android) the Lib (the Native) just crashes.
I only could find something in the unfiltered log. But nothing which i could understand.

As i am not interested in this Library i just put it by side... No problem for me at all.

I´m glad it works for you...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…