question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to create new WASM keyword signatures

See original GitHub issue

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

  • How do I create the Uint8Array values from a generated ppn file?
  • Is there a special wasm platform target in the optimiser tool since the web in general and wasm is platform agnostic, so which platform should I use from the list?

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

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

@kenarsa

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kenarsacommented, Nov 14, 2018

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

0reactions
CobraCallecommented, Sep 10, 2019

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

Thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding WebAssembly text format - MDN Web Docs
Let's start by doing this — first, we'll add a name preceded by a dollar sign, just after the func keyword: (func $add...
Read more >
Build your own WebAssembly Compiler - Scott Logic Blog
These include a type section, which encode type signatures, and function section, which indicates the type of each function. I'll not cover how ......
Read more >
WebAssembly - Quick Guide - Tutorialspoint
The source code written in C, C++ and Rust is compiled to .wasm using a compiler. You can make use of the Emscripten...
Read more >
WebAssembly JavaScript Interface - W3C
To create an exports object from a WebAssembly module module and instance instance , perform the following steps: Let exportsObject be !
Read more >
Understanding WebAssembly Text Format - From WTF to WAT
The function definition follows the same signature as we have in C . Similar to the add example, we define the parameter with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found