Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidCiOSPythonWeb
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Porcupine Wake Word — Go API


API Reference for the Porcupine Go SDK (pkg.go.dev ).


porcupine.BuiltInKeywords

var BuiltInKeywords []BuiltInKeyword

List of available built-in wake words.


porcupine.FrameLength

var FrameLength int

Number of audio samples per frame.


porcupine.SampleRate

var SampleRate int

Audio sample rate accepted by Porcupine.


porcupine.Version

var Version string

Porcupine version.


porcupine.BuiltInKeyword

type BuiltInKeyword string

Type representing a keyword that is packaged with the Porcupine SDK. Possible values are:

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

porcupine.BuiltInKeyword.IsValid()

func (k BuiltInKeyword) IsValid() bool

Checks if a given BuiltInKeyword is valid.


porcupine.Porcupine

type Porcupine struct

Struct for the Porcupine Wake Word engine.


porcupine.Porcupine.AccessKey

var AccessKey string

AccessKey obtained from Picovoice Console (https://console.picovoice.ai/ ).


porcupine.Porcupine.BuiltInKeywords

var BuiltInKeywords []BuiltInKeyword

List of built-in keywords to use.


porcupine.Porcupine.KeywordPaths

var KeywordPaths []string

Absolute paths to keyword model files.


porcupine.Porcupine.LibraryPath

var LibraryPath string

Absolute path to the Porcupine's dynamic library.


porcupine.Porcupine.ModelPath

var ModelPath string

Absolute path to the file containing model parameters.


porcupine.Porcupine.Sensitivities

var Sensitivities []float32

Sensitivity values 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.


porcupine.Porcupine.Delete()

func (porcupine *Porcupine) Delete() error

Releases resources acquired by Porcupine.

Returns

  • error : Error produced by the Porcupine SDK. nil if no error was encountered.

porcupine.Porcupine.Init()

func (porcupine *Porcupine) Init() error

Init function for Porcupine. Must be called before attempting process.

Returns

  • error : Error produced by the Porcupine SDK. nil if no error was encountered.

porcupine.Porcupine.Process()

func (porcupine *Porcupine) Process(pcm []int16) (keywordIndex int, err error)

Processes a frame of the incoming audio stream and emits the detection result. The number of samples-per-frame can be obtained 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. Returns a 0 based index if keyword was detected in frame. Returns -1 if no detection was made.

Parameters

  • pcm []int16 : 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 keywords provided to the Porcupine struct. If no keyword is detected then it returns -1.
  • error : Error produced by the Porcupine SDK. nil if no error was encountered.

porcupine.PorcupineError

type PorcupineError struct

Custom error type for errors produced from the Porcupine Go SDK.


porcupine.PorcupineError.Error()

func (e *PorcupineError) Error() string

Formats the Porcupine error into a string.

Returns

  • string : Formatted error string.

porcupine.PvStatus

type PvStatus struct

Status return codes from the Porcupine library. Possible values are:

const (
SUCCESS PvStatus = 0
OUT_OF_MEMORY PvStatus = 1
IO_ERROR PvStatus = 2
INVALID_ARGUMENT PvStatus = 3
STOP_ITERATION PvStatus = 4
KEY_ERROR PvStatus = 5
INVALID_STATE PvStatus = 6
RUNTIME_ERROR PvStatus = 7
ACTIVATION_ERROR PvStatus = 8
ACTIVATION_LIMIT_REACHED PvStatus = 9
ACTIVATION_THROTTLED PvStatus = 10
ACTIVATION_REFUSED PvStatus = 11
)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word — Go API
  • porcupine.BuiltInKeywords
  • porcupine.FrameLength
  • porcupine.SampleRate
  • porcupine.Version
  • porcupine.BuiltInKeyword
  • IsValid()
  • porcupine.Porcupine
  • AccessKey
  • BuiltInKeywords
  • KeywordPaths
  • LibraryPath
  • ModelPath
  • Sensitivities
  • Delete()
  • Init()
  • Process()
  • porcupine.PorcupineError
  • Error()
  • porcupine.PvStatus
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.