This demo application includes a sample VoiceWidget
Vue component which uses the Picovoice
renderless Vue component service to allow processing naturally spoken phrases within a domain (context) of interest. Wake word events are handled via the ppn-keyword
event. Inference events are handled via the rhn-inference
event. Our VoiceWidget subscribes to this event and displays the results.
The demo uses dynamic imports to split the VoiceWidget
away from the main application bundle. This means that the initial download size of the Vue app will not be impacted by the ~4-6MB requirement of Picovoice. While small for all-in-one offline Voice AI, the size is large for an intial web app load.
If you decline microphone permission in the browser, or another such issue prevents Picovoice from starting, the error will be displayed.
The widget shows the various loading and error events, as well as mounting/unmounting the VoiceWidget
with a toggle, demonstrating the complete lifecycle of Picovoice with in a Vue app.
This project was bootstrapped with Vue CLI. See the Configuration Reference.
yarn
yarn start
The command-line output will provide you with a localhost link and port to open in your browser.
Try saying the wake word "Picovoice", and then a command in the "Clock" context:
"Picovoice, set a timer for ten seconds"
Picovoice's inference result will appear:
{
"isFinalized": true,
"isUnderstood": true,
"intent": "setTimer",
"slots": { "minutes": "1" }
}
Try another interaction, and this time try follow-on command that is outside of the Clock context:
"Picovoice, tell me a joke"
{ "isFinalized": true, "isUnderstood": false, "intent": null, "slots": {} }
context:
expressions:
setAlarm:
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:hours [hour, hours] (and) $pv.TwoDigitInteger:minutes [minute, minutes] (and) $pv.TwoDigitInteger:seconds [second, seconds]"
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:hours [hour, hours] (and) $pv.TwoDigitInteger:minutes [minute, minutes]"
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:hours [hour, hours] (and) $pv.TwoDigitInteger:seconds [second, seconds]"
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:hours [hour, hours]"
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:minutes [minute, minutes] (and) $pv.TwoDigitInteger:seconds [second, seconds]"
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:minutes [minute, minutes]"
- "set (a, an, the) [alarm, timer] for $pv.TwoDigitInteger:seconds [second, seconds]"
- "$pv.TwoDigitInteger:hours [hour, hours] (and) $pv.TwoDigitInteger:minutes [minute, minutes] (and) $pv.TwoDigitInteger:seconds [second, seconds]"
- "$pv.TwoDigitInteger:hours [hour, hours] (and) $pv.TwoDigitInteger:minutes [minute, minutes]"
- "$pv.TwoDigitInteger:hours [hour, hours] (and) $pv.TwoDigitInteger:seconds [second, seconds]"
- "$pv.TwoDigitInteger:hours [hour, hours]"
- "$pv.TwoDigitInteger:minutes [minute, minutes] (and) $pv.TwoDigitInteger:seconds [second, seconds]"
- "$pv.TwoDigitInteger:minutes [minute, minutes]"
- "$pv.TwoDigitInteger:seconds [second, seconds]"
reset:
- "reset (the) (timer)"
pause:
- "[pause, stop] (the) (timer)"
resume:
- "resume (the) (timer)"