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
Python API

API Reference for the Python Porcupine SDK (PyPI).


pvporcupine.create()

def create(
access_key: str,
library_path: Optional[str] = None,
model_path: Optional[str] = None,
keyword_paths: Optional[List[str]] = None,
keywords: Optional[List[str]] = None,
sensitivities: Optional[List[float]] = None) -> Porcupine

Factory method for Porcupine Wake Word engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • library_path Optional[str] : Absolute path to Porcupine's dynamic library. If not set it will be set to the default location.
  • model_path Optional[str] : Absolute path to the file containing model parameters. If not set it will be set to the default location.
  • keyword_paths Optional[List[str]] : Absolute paths to keyword model files. If not set it will be populated from keywords argument.
  • keywords Optional[List[str]] : List of built-in keywords (phrases) for detection. If keyword_paths is set then this argument will be ignored.
  • sensitivities Optional[List[float]] : 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. If not set 0.5 will be used.

Returns

  • Porcupine: An instance of Porcupine Wake Word engine.

Throws

  • PorcupineError

pvporcupine.Porcupine

class Porcupine(object)

Class for the Porcupine Wake Word engine. Porcupine can be initialized either using the module level create() function or directly using the class __init__() method. Resources should be cleaned when you are done using the delete() method.


pvporcupine.Porcupine.version

self.version: str

The version string of the Porcupine library.


pvporcupine.Porcupine.frame_length

self.frame_length: int

The number of audio samples per frame that Porcupine accepts.


pvporcupine.Porcupine.sample_rate

self.sample_rate: int

The audio sample rate the Porcupine accepts.


pvporcupine.Porcupine.__init__()

def __init__(
self,
access_key: str,
library_path: str,
model_path: str,
keyword_paths: List[str],
sensitivities: List[float]) -> Porcupine

__init__ method for Porcupine Wake Word engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • library_path str : Absolute path to Porcupine's dynamic library.
  • model_path str : Absolute path to the file containing model parameters.
  • keyword_paths List[str] : Absolute paths to keyword model files.
  • sensitivities List[float] : 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.

Returns

  • Porcupine: An instance of Porcupine Wake Word engine.

Throws

  • PorcupineError

pvporcupine.Porcupine.delete()

def delete(self)

Releases resources acquired by Porcupine


pvporcupine.Porcupine.process()

def process(self, pcm: List[int]) -> int

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

Parameters

  • pcm List[int] : A frame of audio samples.

Returns

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

Throws

  • PorcupineError

pvporcupine.PorcupineError

class PorcupineError(Exception)

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

Exceptions

class PorcupineActivationError(PorcupineError)
class PorcupineActivationLimitError(PorcupineError)
class PorcupineActivationRefusedError(PorcupineError)
class PorcupineActivationThrottledError(PorcupineError)
class PorcupineIOError(PorcupineError)
class PorcupineInvalidArgumentError(PorcupineError)
class PorcupineInvalidStateError(PorcupineError)
class PorcupineKeyError(PorcupineError)
class PorcupineMemoryError(PorcupineError)
class PorcupineRuntimeError(PorcupineError)
class PorcupineStopIterationError(PorcupineError)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word Python API
  • pvporcupine.create()
  • pvporcupine.Porcupine
  • version
  • frame_length
  • sample_rate
  • __init__()
  • delete()
  • process()
  • pvporcupine.PorcupineError
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.