Porcupine Wake Word
Angular Quick Start
Platforms
- Chrome & Chromium-based browsers
- Edge
- Firefox
- Safari
Requirements
- Picovoice Account and AccessKey
- Node.js 16+
- Angular 13+
- 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 npm packages:
Usage
Put the model file in the project's public directory or generate a base64 model using the build in script:
Create a porcupineModel
object with either of the methods above:
Add the PorcupineService
to an Angular component. Subscribe to the keywordDetection
event for the built-in keywords porcupine
and bumblebee
:
The PorcupineService
will take care of microphone access and audio downsampling (via @picovoice/web-voice-processor
).
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.
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
:
Non-English Languages
In order to use Porcupine Wake Word with other languages, you need to use the corresponding model file (.pv
) for the desired language. The model files for all
supported languages are available on the Porcupine GitHub repository.
Demo
For the Porcupine Wake Word Angular SDK, there is an Angular 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:4200 to view it in the browser.
Resources
Packages
- @picovoice/porcupine-angular on the npm registry
- @picovoice/porcupine-web on the npm registry
- @picovoice/web-voice-processor on the npm registry