Porcupine Wake Word
React API
API Reference for the Porcupine React SDK (npmjs).
usePorcupine()
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 thewebVoiceProcessor
is passing audio to the engine.error
Error | null : AnError
object containing details about the error.init
(...) => Promise<void> : A method to initializePorcupine
given 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
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()
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.