Porcupine Wake Word
React API
API Reference for the Porcupine React SDK (npmjs).
usePorcupine()
React Hook for Porcupine Wake Word engine.
Returns
keywordDetectionPorcupineDetection | null : A state containing keyword result value.isLoadedboolean : A state indicating whether the engine is initialized successfully.isListeningboolean : A state indicating whether thewebVoiceProcessoris passing audio to the engine.errorError | null : AnErrorobject containing details about the error.init(...) => Promise<void> : A method to initializePorcupinegiven the arguments. Seeinit.start() => Promise<void> : A method to start processing the audio. Seestart.stop() => Promise<void> : A method to stop processing the audio.stop.release() => Promise<void> : Releases resources acquired byusePorcupine. Seerelease.
init()
Initializes usePorcupine hook. Sets isLoaded state to true.
Parameters
accessKeystring : AccessKey obtained from Picovoice Console.keywordsArray<PorcupineKeyword | BuiltInKeyword> | PorcupineKeyword | BuiltInKeyword: Object containing Porcupine keyword data.modelPorcupineModel : Object containing Porcupine model.
start()
Starts keyword detection.
If started, isListening is set to true.
stop()
Stops keyword detection. Sets isListening to false.
release()
Releases resources acquired by the usePorcupine and all internal states.