Porcupine Wake Word
Web Quick Start
Platforms
- Chrome & Chromium-based browsers
- Edge
- Firefox
- Safari
Requirements
- Picovoice Account and AccessKey
- Node.js 16+
- npm
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Install Node.js.
Install the Web Voice Processor and the porcupine Web package:
Usage
Put the model file in the project's public directory or generate a base64 model using the build in script:
Create a PorcupineWorker
instance using the model from public directory:
or using the base64 model:
Subscribe the engine to the Web Voice Processor:
Release resources explicitly when done with Porcupine Wake Word:
Custom Keywords
Create custom keywords using the Picovoice Console.
Train and download a Porcupine Wake Word keyword model (.ppn
) for the target platform Web (WASM)
.
This model file can be used directly with publicPath
, but, if base64
is preferable, convert the .ppn
file to a base64
JavaScript variable using the built-in pvbase64
script:
Similar to the model file (.pv
), keyword files (.ppn
) are saved in IndexedDB to be used by Web Assembly.
Either base64
or publicPath
must be set for each keyword to instantiate Porcupine Wake Word.
If both are set, Porcupine Wake Word will use the base64
model.
An arbitrary label
is required to identify the keyword once the detection occurs.
Then, initialize an instance of Porcupine Wake Word
:
Non-English Languages
In order to detect non-English wake words you need to use the corresponding model file (.pv
). The model files for all
supported languages are available on the Picovoice GitHub repository.
Demo
For the Porcupine Wake Word Web SDK, there is a Web demo project available on the Porcupine GitHub repository.
Setup
Clone the Porcupine Wake Word repository from GitHub:
Usage
- Install the dependencies and use the
start
script with a language code to start the demo in the language of your choice (e.g.de
-> German,ko
-> Korean). To see a list of available languages, runstart
without a language code.
- Open http://localhost:5000 to view it in the browser.