Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice CheetahAzure Real-Time Speech-to-TextAmazon Transcribe StreamingGoogle Streaming ASR
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 NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice PorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice CobraWebRTC VADSilero VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Porcupine Wake Word
Node.js API

API Reference for the Node.js Porcupine SDK (npmjs).


Porcupine

class Porcupine

Class for the Porcupine wake word engine. Porcupine can be initialized using the class constructor(). Resources should be cleaned when you are done using the release() method.


Porcupine.constructor()

Porcupine.constructor(
accessKey,
keywords,
sensitivities,
options: PorcupineOptions = {}
)

constructor method for Porcupine wake word engine.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywords Array<string> : Absolute paths to keyword model files.
  • sensitivities Array<number> : Sensitivities for detecting keywords. Each value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • options PorcupineOptions : Optional init configuration arguments:
    • modelPath string : Path to the file containing model parameters (.pv).
    • device string : String representation of the device (e.g., CPU or GPU) to use. If set to best, the most suitable device is selected automatically. If set to gpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument to gpu:${GPU_INDEX}, where ${GPU_INDEX} is the index of the target GPU. If set to cpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument to cpu:${NUM_THREADS}, where ${NUM_THREADS} is the desired number of threads.
    • libraryPath string : Path to the Orca dynamic library (.node).

Returns

  • Porcupine: An instance of Porcupine wake word engine.

Porcupine.listAvailableDevices()

static listAvailableDevices(options: PorcupineInputOptions = {}): string[]

Lists all available devices that Porcupine can use for inference. Each entry in the list can be the device argument of the constructor.

Parameters

  • options PorcupineInputOptions : Optional input configuration arguments:
    • libraryPath string : Path to the Porcupine dynamic library (.node).

Returns

  • string[] : List of all available devices that Porcupine can use for inference.

Porcupine.process()

process(frame: Int16Array): 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 .sampleRate and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.

Parameters

  • frame Array<number> : A frame of audio samples.

Returns

  • 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.

Porcupine.frameLength

get frameLength(): number

The number of audio samples per frame.


Porcupine.sampleRate

get sampleRate(): number

The audio sample rate accepted by the Porcupine engine.


Porcupine.version

get version(): string

The version of the Porcupine engine.


Porcupine.release()

release(): void

Releases resources acquired by Porcupine


PorcupineOptions

type PorcupineOptions = {
modelPath?: string;
device?: string;
libraryPath?: string;
};

Porcupine init options type.

  • modelPath string : The path to the Porcupine model (.pv).
  • device string? : String representation of the device (e.g., CPU or GPU) to use for inference. If set to best, picoLLM picks the most suitable device. If set to gpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument to gpu:${GPU_INDEX}, where ${GPU_INDEX} is the index of the target GPU. If set to cpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument to cpu:${NUM_THREADS}, where ${NUM_THREADS} is the desired number of threads.
  • libraryPath string : The path to the Porcupine dynamic library.

PorcupineInputOptions

type PorcupineInputOptions = {
libraryPath?: string;
};

Porcupine input options type.

  • libraryPath string : The path to the Porcupine dynamic library.

BuiltInKeyword

enum BuiltInKeyword {
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",
}

Enum of built-in keywords.


Errors

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

Exceptions:

class PvStatusOutOfMemoryError extends Error {}
class PvStatusIoError extends Error {}
class PvStatusInvalidArgumentError extends Error {}
class PvStatusStopIterationError extends Error {}
class PvStatusKeyError extends Error {}
class PvStatusInvalidStateError extends Error {}
class PvStatusRuntimeError extends Error {}
class PvStatusActivationError extends Error {}
class PvStatusActivationLimitReached extends Error {}
class PvStatusActivationThrottled extends Error {}
class PvStatusActivationRefused extends Error {}

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word Node.js API
  • Porcupine
  • constructor()
  • listAvailableDevices()
  • process()
  • frameLength
  • sampleRate
  • version
  • release()
  • PorcupineOptions
  • PorcupineInputOptions
  • BuiltInKeyword
  • Errors
Voice AI
  • picoLLM On-Device LLM
  • 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
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.