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

Porcupine Wake Word — React API


API Reference for the Porcupine React SDK (npmjs).


usePorcupine()

function usePorcupine(): {
keywordDetection: PorcupineDetection | null,
isLoaded: boolean,
isListening: boolean,
error: string | null,
init: (
accessKey: string,
keywords: Array<PorcupineKeyword | BuiltInKeyword> | PorcupineKeyword | BuiltInKeyword,
model: PorcupineModel,
options?: PorcupineOptions,
) => Promise<void>,
start: () => Promise<void>,
stop: () => Promise<void>,
release: () => Promise<void>,
}

React Hook for Porcupine wake word engine.

Returns

  • keywordDetection PorcupineDetection | null : A state containing keyword result value.
  • isLoaded boolean : A state indicating whether the engine is initialized successfully.
  • isListening boolean : A state indicating whether the webVoiceProcessor is passing audio to the engine.
  • error string | null : A string expression of the error.
  • init (...) => Promise<void> : A method to initialize Porcupine given the arguments. See init.
  • start () => Promise<void> : A method to start processing the audio. See start.
  • stop () => Promise<void> : A method to stop processing the audio. stop.
  • release () => Promise<void> : Releases resources acquired by usePorcupine. See release.

init()

async function init(
accessKey: string,
keywords: Array<PorcupineKeyword | BuiltInKeyword> | PorcupineKeyword | BuiltInKeyword,
model: PorcupineModel
): Promise<void>

Initializes usePorcupine hook. Sets isLoaded state to true.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywords Array<PorcupineKeyword | BuiltInKeyword> | PorcupineKeyword | BuiltInKeyword: Object containing Porcupine keyword data.
  • model PorcupineModel : Object containing Porcupine model.

start()

async function start(): Promise<void>

Starts keyword detection. If started, isListening is set to true.

stop()

async function stop(): Promise<void>

Stops keyword detection. Sets isListening to false.

release()

async function release(): Promise<void>

Releases resources acquired by the usePorcupine and all internal states.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word — React API
  • usePorcupine()
  • init()
  • start()
  • stop()
  • release()
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.