Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Porcupine Wake Word
React Native API

API Reference for the React Native Porcupine SDK (npm)


Porcupine

class Porcupine { }

Class for the Porcupine Wake Word engine.

Use this class when using a custom audio processing pipeline. Otherwise it is recommended to use the PorcupineManager High-Level API, which contains integrated audio recording.

Porcupine.fromBuiltInKeywords()

public static async fromBuiltInKeywords(
accessKey: string,
keywords: BuiltInKeywords[],
modelPath: string = '',
sensitivities: number[] = []
)

Porcupine constructor when using built-in keywords.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywords BuiltInKeyword[] : List of built-in keywords for detection.
  • modelPath string : Optional. Path to the file containing model parameters (.pv). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • sensitivities number[] : Optional. Sensitivities for detecting keywords. Each value should be a number within [0, 1].

Returns

  • Promise<Porcupine>: An instance of Porcupine Wake Word engine.

Porcupine.fromKeywordPaths()

public static async fromKeywordPaths(
accessKey: string,
keywordsPaths: string[],
modelPath: string = '',
sensitivities: number[] = []
)

Porcupine constructor when using keyword paths.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywordPaths string[] : List of paths to keyword files (.ppn). Can be relative to the assets/resource folder or absolute paths to the files on device.
  • modelPath string : Optional. Absolute path to the file containing model parameters (.pv). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • sensitivities number[] : Optional. Sensitivities for detecting keywords. Each value should be a number within [0, 1].

Returns

  • Promise<Porcupine>: An instance of Porcupine Wake Word engine.

Porcupine.delete()

async delete()

Releases resources acquired by Porcupine.


Porcupine.frameLength

get frameLength()

Getter for number of audio samples per frame.

Returns

  • number: Number of audio samples per frame.

Porcupine.sampleRate

get sampleRate()

Getter for audio sample rate accepted by Picovoice.

Returns

  • number: Audio sample rate accepted by Picovoice.

Porcupine.version

get version()

Getter for version.

Returns

  • string: Current Porcupine version.

Porcupine.process()

async process(frame: number[]): Promise<number>

Processes a frame of the incoming audio stream and emits the detection result. The number of samples per frame can be attained by calling .frameLength. The incoming audio needs to have a sample rate equal to .sampleRateand be 16-bit linearly-encoded. Porcupine operates on single-channel audio.

Parameters

  • frame number[] : A frame of audio samples.

Returns

  • Promise<number>: Index of observed keyword at the end of the current frame. Indexing is 0-based and matches the ordering of keyword models provided to the constructor. If no keyword is detected then it returns -1.

BuiltInKeywords

enum BuiltInKeyword { }

Enum of available built-in keywords for Porcupine Wake Word engine.

Values:

  • ALEXA = "alexa"
  • AMERICANO = "americano"
  • BLUEBERRY = "blueberry"
  • BUMBLEBEE = "bumblebee"
  • COMPUTER = "computer"
  • GRAPEFRUIT = "grapefruit"
  • GRASSHOPPER = "grasshopper"
  • HEY_GOOGLE = hey google"
  • HEY_SIRI = hey siri"
  • JARVIS = "jarvis"
  • OK_GOOGLE = ok google"
  • PICOVOICE = "picovoice"
  • PORCUPINE = "porcupine"
  • TERMINATOR = "terminator"

PorcupineError

class PorcupineError extends Error { }

Exception thrown if an error occurs within Porcupine Wake Word engine.

Exceptions:

class PorcupineActivationError extends PorcupineError { }
class PorcupineActivationLimitError extends PorcupineError { }
class PorcupineActivationRefusedError extends PorcupineError { }
class PorcupineActivationThrottledError extends PorcupineError { }
class PorcupineIOError extends PorcupineError { }
class PorcupineInvalidArgumentError extends PorcupineError { }
class PorcupineInvalidStateError extends PorcupineError { }
class PorcupineKeyError extends PorcupineError { }
class PorcupineMemoryError extends PorcupineError { }
class PorcupineRuntimeError extends PorcupineError { }
class PorcupineStopIterationError extends PorcupineError { }

PorcupineManager

class PorcupineManager { }

High-level React Native binding for Porcupine Wake Word engine. It handles recording audio from microphone, processes it in real-time using Porcupine, and notifies the client when any of the given keywords are detected.

This class offers integrated audio capture. For use-cases where there is already an audio-processing pipeline in place, use the Porcupine Low-Level API.

PorcupineManager.fromBuiltInKeywords()

public static async fromBuiltInKeywords(
accessKey: string,
keywords: BuiltInKeywords[],
detectionCallback: DetectionCallback,
processErrorCallback?: ProcessErrorCallback,
modelPath?: string,
sensitivities?: number[]
)

Porcupine constructor when using built-in keywords.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywords BuiltInKeyword[] : List of built-in keywords for detection.
  • detectionCallback DetectionCallback : A callback for when Porcupine detects the specified keywords.
  • processErrorCallback ProcessErrorCallback : Optional. A callback for when Porcupine process function triggers an error.
  • modelPath string : Optional. Absolute path to the file containing model parameters (.pv). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • sensitivities number[] : Optional. Sensitivities for detecting keywords. Each value should be a number within [0, 1].

Returns

  • Promise<Porcupine>: An instance of Porcupine Wake Word engine.

PorcupineManager.fromKeywordPaths()

public static async fromKeywordPaths(
accessKey: string,
keywordPaths: string[],
detectionCallback: DetectionCallback,
processErrorCallback?: ProcessErrorCallback,
modelPath?: string,
sensitivities?: number[]
)

Porcupine constructor when using keyword paths.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywordPaths string[] : List of paths to keyword files (.ppn). Can be relative to the assets/resource folder or absolute paths to the files on device.
  • detectionCallback DetectionCallback : A callback for when Porcupine detects the specified keywords.
  • processErrorCallback ProcessErrorCallback : Optional. A callback for when Porcupine process function triggers an error.
  • modelPath string : Optional. Absolute path to the file containing model parameters (.pv). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • sensitivities number[] : Optional. Sensitivities for detecting keywords. Each value should be a number within [0, 1].

Returns

  • Promise<Porcupine>: An instance of Porcupine Wake Word engine.

PorcupineManager.delete()

public delete()

Releases resources acquired by PorcupineManager.


PorcupineManager.start()

public async start()

Starts recording audio from the microphone and monitors it for the utterances of the given set of keywords.


PorcupineManager.stop()

public async stop()

Stops recording audio from the microphone.


DetectionCallback

type DetectionCallback = (keywordIndex: number) => void;

Callback interface invoked when a keyword has been detected.


ProcessErrorCallback

type ProcessErrorCallback = (error: PorcupineErrors.PorcupineError) => void;

Callback interface invoked when an error occurs while processing audio.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word React Native API
  • Porcupine
  • fromBuiltInKeywords()
  • fromKeywordPaths()
  • delete()
  • frameLength
  • sampleRate
  • version
  • process()
  • BuiltInKeywords
  • PorcupineError
  • PorcupineManager
  • fromBuiltInKeywords()
  • fromKeywordPaths()
  • delete()
  • start()
  • stop()
  • DetectionCallback
  • ProcessErrorCallback
Voice AI
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.