Rhino Speech-to-Intent
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 Rhino Web packages:
Usage
To initialize Rhino
you'll need a
Rhino context file (.rhn
) as well as a
model file (.pv
). Place these files in the project's
public directory or generate a base64 representation of the file using the built-in script:
Pass the path to the file (relative to the public directory) or use the base64 string:
Create a RhinoWorker
that infers intent from spoken commands within
a given context :
Subscribe RhinoWorker
to WebVoiceProcessor to pass audio to the Rhino engine:
Once done, unsubscribe to stop processing audio frames:
Release resources explicitly when done with Rhino:
Custom Contexts
Create custom contexts in the Picovoice Console using
the Rhino Grammar. Train and download a Rhino context file (.rhn
) for the target platform Web (WASM)
. This model file can be used directly with publicPath
, but, if base64
is preferable, convert the .rhn
file to a base64
JavaScript variable using the built-in pvbase64
script:
Similar to the model file (.pv
), context files (.rhn
) are saved in IndexedDB to be used by Web Assembly. Either base64
or publicPath
must be set for the context to instantiate Rhino.
If both are set, Rhino will use the base64
model.
Switching Languages
In order to use Rhino with different languages you need to use the corresponding model file (.pv
) for the desired language.
The model files for all supported languages are available in the Rhino GitHub repository.
Demo
For the Rhino Web SDK, there is a Web demo project available on the Rhino GitHub repository .
Setup
Clone the Rhino 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.