Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Picovoice Platform
Vue Quick Start


Platforms

  • Chrome & Chromium-based browsers
  • Edge
  • Firefox
  • Safari

Requirements

  • Picovoice Account and AccessKey
  • Node.js 14+
  • Vue 2.6.11+, 3.0.0+
  • npm

Picovoice Account & AccessKey

Signup or Login to Picovoice Console to obtain your AccessKey. Make sure to keep your AccessKey secret.

Quick Start

Setup

  1. Install Node.js.

  2. Install the picovoice-vue and web-voice-processor packages.

npm install @picovoice/picovoice-vue @picovoice/web-voice-processor

Usage

To initialize Picovoice you'll need a Porcupine keyword file (.ppn) and model file (.pv), as well as a Rhino context file (.rhn) and 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:

npx pvbase64 -i ${PICOVOICE_INIT_FILE} -o ${BASE64_OUTPUT_FILE}

Create a Vue Component with usePicovoice and initialize instance of Picovoice:

<script lang='ts'>
import { usePicovoice } from '@picovoice/picovoice-vue';
const porcupineKeyword = {publicPath: "${PPN_KEYWORD_PATH}"};
const porcupineModel = {publicPath: "${PPN_MODEL_PATH}"};
const rhinoContext = {publicPath: "${RHN_CONTEXT_PATH}"};
const rhinoModel = {publicPath: "${RHN_MODEL_PATH}"};
export default {
data() {
const {
state,
init,
start,
stop,
release
} = usePicovoice();
init(
${ACCESS_KEY},
porcupineKeyword,
porcupineModel,
rhinoContext,
rhinoModel,
);
return {
state,
start,
stop,
release
}
},
watch: {
"state.wakeWordDetection": function(wakeWord) {
if (wakeWord !== null) {
console.log(wakeWord)
}
},
"state.inference": function(inference) {
if (inference !== null) {
console.log(inference)
}
},
"state.contextInfo": function(contextInfo) {
if (contextInfo !== null) {
console.log(contextInfo)
}
},
"state.isLoaded": function(isLoaded) {
console.log(isLoaded)
},
"state.isListening": function(isListening) {
console.log(isListening)
},
"state.error": function(error) {
console.error(error)
},
},
onBeforeDestroy() {
this.release();
},
};
</script>

To learn how to use PicovoiceVue with Vue's Composition API, check Picovoice Vue GitHub Repo.

The SDK will take care of microphone access and audio downsampling ( via @picovoice/web-voice-processor).

To start audio recording and processing:

await this.start()

To stop audio recording and processing:

await this.stop()

Clean up resources explicitly with:

this.release();

Custom Keywords and Contexts

Create custom keywords and contexts using the Picovoice Console. Train a Porcupine keyword to obtain a keyword file (.ppn) and a Rhino context to obtain a context file (.rhn). To use them with the Web SDK, train the keywords and contexts for the target platform Web (WASM). These model files can be used directly with publicPath, but, if base64 is preferable, convert to base64 JavaScript variable using the built-in pvbase64 script:

npx pvbase64 -i ${INPUT_BINARY_FILE}.{ppn/rhn} -o ${OUTPUT_BASE64_FILE}.js -n ${BASE64_VAR_NAME}

Similar to the model file (.pv), these files are saved in IndexedDB to be used by Web Assembly. Either base64 or publicPath must be set for each file to initialize Picovoice. If both are set, Picovoice will use the base64 model.

const picovoiceFile = {
publicPath: "${FILE_RELATIVE_PATH}",
// or
base64: "${FILE_BASE64_STRING}",
}

Switching Languages

In order to use Picovoice 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 Porcupine and Rhino GitHub repositories.

Demo

For the Picovoice Vue SDK, there is a Vue demo project available on the Picovoice GitHub repository.

Setup

Clone the Picovoice repository from GitHub:

git clone --recurse-submodules https://github.com/Picovoice/picovoice.git

Usage

  1. Install dependencies and run:
cd picovoice/demo/vue
npm install
npm run start
  1. Open http://localhost:8080 to view it in the browser.

Resources

Packages

  • @picovoice/picovoice-vue on the npm registry
  • @picovoice/web-voice-processor on the npm registry

API

  • @picovoice/picovoice-vue API Docs

GitHub

  • Picovoice Vue SDK on GitHub
  • Picovoice Vue Demo on GitHub

Benchmarks

  • Wake Word Benchmark
  • Speech-to-Intent Benchmark

Further Reading

  • It’s Time for Local Speech Recognition

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Picovoice Platform Vue Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Usage
  • Custom Keywords and Contexts
  • Switching Languages
  • Demo
  • Setup
  • Usage
  • Resources
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.