This demo application includes a VoiceWidget
React function component which includes the usePicovoice
react hook to allow wake word detection and follow-on command inference.
If you decline microphone permission in the browser, or another such issue prevents Picovoice from starting, an error will be displayed.
The widget shows the various loading and error states, as well as mounting/unmounting the VoiceWidget
with a toggle button, demonstrating the complete lifecycle of the Picovoice SDK within a React app.
This project was bootstrapped with Create React App.
Picovoice requires a valid Picovoice AccessKey
at initialization. AccessKey
acts as your credentials when using Picovoice SDKs.
You can get your AccessKey
for free. Make sure to keep your AccessKey
secret.
Signup or Login to Picovoice Console to get your AccessKey
.
Use yarn
or npm
to install the dependencies, and the start
script with a language code
to start a local web server hosting the demo in the language of your choice (e.g. sv
-> Swedish, zh
-> Mandarin).
To see a list of available languages, run start
without a language code.
yarn
yarn start ${LANGUAGE}
(or)
npm install
npm run start ${LANGUAGE}
Open http://localhost:3000
to view it in the browser.
- Enter your
AccessKey
in the provided input field - Click the
Init Picovoice
button and wait until Picovoice has been initialized - Click the
Start
button to start recording audio - Say the indicated wakeword, then try to say a command within the context indicated at the bottom of the page