pythonPicovoice Platform — Python API

  • End-to-End Voice Platform
  • Offline Voice Recognition
  • Local Speech Recognition
  • Speech-to-Intent
  • Domain-Specific NLU
  • Wake Word Detection
  • Raspberry Pi
  • BeagleBone
  • Nvidia Jetson
  • Linux
  • macOS
  • Windows
  • Python

This document outlines how to integrate Picovoice platform within an application using its Python API.


  • Python 3
  • PIP


  • Linux (x86_64)
  • macOS (x86_64)
  • Windows (x86_64)
  • Raspberry Pi (all variants)
  • Nvidia Jetson (Nano)
  • BeagleBone


pip3 install picovoice


Create a new instance of Picovoice runtime engine

from picovoice import Picovoice
keyword_path = ...
def wake_word_callback():
context_path = ...
def inference_callback(inference):
# `inference` exposes three immutable fields:
# (1) `is_understood`
# (2) `intent`
# (3) `slots`
handle = Picovoice(

handle is an instance of Picovoice runtime engine that detects utterances of wake phrase defined in the file located at keyword_path. Upon detection of wake word it starts inferring user's intent from the follow-on voice command within the context defined by the file located at context_path. keyword_path is the absolute path to Porcupine wake word engine keyword file (with .ppn suffix). context_path is the absolute path to Rhino Speech-to-Intent engine context file (with .rhn suffix). wake_word_callback is invoked upon the detection of wake phrase and inference_callback is invoked upon completion of follow-on voice command inference.

When instantiated, valid sample rate can be obtained via handle.sample_rate. Expected number of audio samples per frame is handle.frame_length. The engine accepts 16-bit linearly-encoded PCM and operates on single-channel audio.

def get_next_audio_frame():
while True:

When done resources have to be released explicitly


Custom Wake Word & Context

You can create custom Porcupine wake word and Rhino context models using Picovoice Console

Non-English Models

In order to detect wake words and run inference in other languages you need to use the corresponding model file. The model files for all supported languages are available here and here.

Issue with this doc? Please let us know.