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

How to create new WASM keyword signatures #95

Closed JarvisPrestidge closed 6 years ago

JarvisPrestidge commented 6 years ago

Issue

I'm using windows and trying to adapt the js demo for use in nodejs (btw that would be a really useful demo, and i'm happy to submit a pr once I figure this out!).

I can run the example in firefox locally fine 👍

I'm now trying to create my own keyword signature using the optimiser tool:

$ tools/optimizer/windows/amd64/pv_porcupine_optimizer.exe -r resources/ -p windows -o . -w "ok l
amp"

in this case i'm copying the existing keyword "ok lamp" to see if I can create the same Uint8Array, or just to at least see it work with a keyword i've generated.

I'm using xxd to convert the output file into a hexadecimal string.

$ xxd -p ok\ lamp_windows.ppn

ebb54e7a075a872fdf7d87cb23da698f3c19141120c27327d6ceff8c6c65
2c85f196e30f22dda6d7bab3f5289e9a261cfd943de716f81760d4f820c3
0f67f4bbf14301e993e5048c9197e638c7bcdc805b483642675f086b

then I format the output to copy the demo, i.e.

0xeb, 0xb5, 0x4e, 0x7a, 0x07, 0x5a, 0x87, 0x2f, 0xdf, 0x7d, 0x87, 0xcb, 0x23, 0xda, 0x69, 0x8f, 0x3c, 0x19, 0x14, 0x11, 0x20, 0xc2, 0x73, 0x27, 0xd6, 0xce, 0xff, 0x8c, 0x6c, 0x65, 0x2c, 0x85, 0xf1, 0x96, 0xe3, 0x0f, 0x22, 0xdd, 0xa6, 0xd7, 0xba, 0xb3, 0xf5, 0x28, 0x9e, 0x9a, 0x26, 0x1c, 0xfd, 0x94, 0x3d, 0xe7, 0x16, 0xf8, 0x17, 0x60, 0xd4, 0xf8, 0x20, 0xc3, 0x0f, 0x67, 0xf4, 0xbb, 0xf1, 0x43, 0x01, 0xe9, 0x93, 0xe5, 0x04, 0x8c, 0x91, 0x97, 0xe6, 0x38, 0xc7, 0xbc, 0xdc, 0x80, 0x5b, 0x48, 0x36, 0x42, 0x67, 0x5f, 0x08, 0x6b

pop that in the demo file in-place of the existing "ok lamp" value and run the local demo to no avail. I get the following error:

[ERROR] keyword file has incorrect format or belongs to a different platform
[ERROR] parsing keyword ID #0 failed with 'INVALID_ARGUMENT'

Questions

for example: I can see there are *_wasm.ppn files in the /resources directory,

p.s. this is a super fricking cool project 🙂

@kenarsa

kenarsa commented 6 years ago

Happy that you find the repo useful. The answer you are looking for is the FAQ of README for optimizer tool. https://github.com/Picovoice/Porcupine/tree/master/tools/optimizer

Basically, we consider WASM a different platform (regardless of OS browser is running on). That means that you cannot use the optimizer to create your own WASM files. We offer custom keyword files for WASM and a number of other platforms for customers who choose the purchase the commercial license.

That being said there are a number of free models available in the repo under keyword_files/ folder. You can use them freely. In the next few days, I will add more WASM files so that it has the same number of free models as other platforms.

syntithenai commented 6 years ago

Some requests on WASM keyword files to support a few open source projects.

For my browser based (soon to be speech enabled) music library, "Hey Meeka"

For my flashcard/learning application (https://github.com/syntithenai/mnemolibrary), "Hey Nemo" For demo with open source content https://mnemolibrary.com

For my snips-webbrowser-audioserver npm package, I'd like "Hey Snips" and "Hey Mycroft". Currently using "OK Lamp".

I imagine Hey Snips would be very popular and generate commercial interest in additional hotwords. The audioserver package allows a browser to behave as a satellite in the Snips mqtt ecosystem so bridging Snips from being a raspberry pi based solution to something that can ship as part of a website hosting suite (with custom hotword).

Thanks for your consideration cheers Steve Ryan

benedikt-roth commented 6 years ago

It is a bit disappointing to not have any more generic keywords available. I wanted to use this library as a showcase demo for a SAP Cloud product, but the sole availability of "ok lamp" renders useless for any case studies.

kenarsa commented 6 years ago

Check out v1.5 now you have about 20 more models in the resource directory. hope it helps.

CobraCalle commented 5 years ago

can you add "Computer" (like in Startrek)... that would help me a lot with my private voice control...?

Thank you very much