Picovoice / porcupine

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

Porcupine Issue: #1236

Closed mohsintariq-locai closed 9 months ago

mohsintariq-locai commented 9 months ago

Have you checked the docs and existing issues?

SDK

React

Porcupine package version

3.0.3

Framework version

React

Platform

Web (WASM)

OS/Browser version

mac os

Describe the bug

Here is my code

import model from './lib/model_file.js'
import keyword from './lib/hello-ravi_en_wasm_v3_0_0/keyword_file.js'

console.log(model);
console.log(keyword);
const porcupineKeyword = {
  // publicPath: "./lib/hello-ravi_en_wasm_v3_0_0/alexa_wasm.ppn",
  base64: keyword,
  label: "alexa"
}

const porcupineModel = {
  // publicPath: "./lib/porcupine_params.pv",
  base64: model
}

...

const initEngine = useCallback(async () => {
    console.log(BuiltInKeyword);
    await init(
      "jPTQx+....",
      [porcupineKeyword],
      porcupineModel
    );
  }, [])

Here is my react package:

"@picovoice/porcupine-react": "^3.0.3",
"@picovoice/web-voice-processor": "^4.0.8",

I am getting this error

PorcupineInvalidArgumentError: Initialization failed: [0] Keyword file (.ppn) file has incorrect format or belongs to a different platform. [1] Picovoice Error (code00000136) [2] Loading keyword file atalexafailed withINVALID_ARGUMENT.

Wasted a whole day to get the demo up and running but i am unable to. Any help would be awesome.

Steps To Reproduce

  1. Download the react demo folder
  2. train a wake word on console
  3. run the demo with the files and api keys

Expected Behavior

The demo should have run smoothly.

albho commented 9 months ago

hey mohsintariq, two questions:

  1. is the original react demo working for you?
  2. it looks like you're trying to use the base64 version of the model and keyword. Could you provide the exact steps you took to create these files?
mohsintariq-locai commented 9 months ago

Writing the flag forceWrite: true solved the issue

const porcupineKeyword = {
  base64: keyword,
  label: "asd",
  forceWrite: true
}

const porcupineModel = {
  base64: model,
  forceWrite: true
}