goPicovoice Platform — Go API

  • End-to-End Voice Platform
  • Offline Voice Recognition
  • Local Speech Recognition
  • Speech-to-Intent
  • Domain-Specific NLU
  • Wake Word Detection
  • Linux
  • macOS
  • Windows
  • Go

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


  • Go SDK 1.16+
  • On Windows you need to have a gcc (like Mingw) in your path


  • Runs on Linux (x86_64), macOS (x86_64) and Windows (x86_64)
  • Go 1.16+


You can install the latest version of Picovoice into your Go module by running:

go get

Depending on your setup you also may need to run go mod tidy after in order to download transitive dependencies.


To create an instance of the engine with default parameters, use the NewPicovoice function. You must provide a Porcupine keyword file, a wake word detection callback function, a Rhino context file and a inference callback function. You must then make a call to Init().

. ""
rhn ""
keywordPath := "/path/to/keyword/file.ppn"
wakeWordCallback := func(){
// let user know wake word detected
contextPath := "/path/to/keyword/file.rhn"
inferenceCallback := func(inference rhn.RhinoInference){
if inference.IsUnderstood {
intent := inference.Intent
slots := inference.Slots
// add code to take action based on inferred intent and slot values
} else {
// add code to handle unsupported commands
picovoice := NewPicovoice(keywordPath,
err := picovoice.Init()
if err != nil {
// handle error

Upon detection of wake word defined by keywordPath it starts inferring user's intent from the follow-on voice command within the context defined by the file located at contextPath. keywordPath is the absolute path to Porcupine wake word engine keyword file (with .ppn suffix). contextPath is the absolute path to Rhino Speech-to-Intent engine context file (with .rhn suffix). wakeWordCallback is invoked upon the detection of wake phrase and inferenceCallback is invoked upon completion of follow-on voice command inference.

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

func getNextFrameAudio() []int16{
// get audio frame
for {
err := picovoice.Process(getNextFrameAudio())

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.