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

Picovoice Platform — Go API


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


picovoice.FrameLength

var FrameLength int

Number of audio samples per frame.


picovoice.SampleRate

var SampleRate int

Audio sample rate accepted by Picovoice.


picovoice.PorcupineVersion

var PorcupineVersion string

Version of Porcupine being used by the Picovoice SDK.


picovoice.RhinoVersion

var RhinoVersion string

Version of Rhino being used by the Picovoice SDK.


picovoice.Version

var Version string

Picovoice version.


picovoice.InferenceCallbackType

type InferenceCallbackType func(RhinoInference)

Callback for when Rhino has made an inference. Receives a RhinoInference object.


picovoice.NewPicovoice()

func NewPicovoice(
accessKey string,
keywordPath string,
wakewordCallback WakeWordCallbackType,
contextPath string,
inferenceCallback InferenceCallbackType) Picovoice

Creates a Picovoice struct with default parameters, and the given keyword and context files.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console (https://console.picovoice.ai/ ).
  • keywordPath string : Absolute path to Porcupine keyword file (.ppn).
  • wakewordCallback WakeWordCallbackType : Function to be called once the wake word has been detected.
  • contextPath string : Absolute path to the Rhino context file (.rhn).
  • inferenceCallback InferenceCallbackType : Function to be called once Rhino has an inference ready.

Returns

  • Picovoice : An instance of Picovoice struct.

picovoice.Picovoice

type Picovoice struct

Struct for the Picovoice End-to-End Voice Platform.


picovoice.Picovoice.AccessKey

var AccessKey string

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


picovoice.Picovoice.ContextInfo

var ContextInfo string

Once initialized, stores the source of the Rhino context in YAML format. Shows the list of intents, which expressions map to those intents, as well as slots and their possible values.


picovoice.Picovoice.ContextPath

var ContextPath string

Absolute path to the Rhino context file (.rhn).


picovoice.Picovoice.InferenceCallback

var InferenceCallback InferenceCallbackType

Function to be called once Rhino has an inference ready.


picovoice.Picovoice.KeywordPath

var KeywordPath string

Path to Porcupine keyword file (.ppn).


picovoice.Picovoice.PorcupineLibraryPath

var PorcupineLibraryPath string

Absolute path to Porcupine's dynamic library.


picovoice.Picovoice.PorcupineModelPath

var PorcupineModelPath string

Path to Porcupine model file (.pv).


picovoice.Picovoice.PorcupineSensitivity

var PorcupineSensitivity float32

Sensitivity value for detecting keyword. The value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.


picovoice.Picovoice.EndpointDurationSec

var EndpointDurationSec float32

Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.


picovoice.Picovoice.RequireEndpoint

var RequireEndpoint bool

If set to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false only if operating in an environment with overlapping speech (e.g. people talking in the background).


picovoice.Picovoice.RhinoLibraryPath

var RhinoLibraryPath string

Absolute path to Rhino's dynamic library.


picovoice.Picovoice.RhinoModelPath

var RhinoModelPath string

Path to Rhino model file (.pv).


picovoice.Picovoice.RhinoSensitivity

var RhinoSensitivity float32

Inference sensitivity. A higher sensitivity value results in fewer misses at the cost of (potentially) increasing the erroneous inference rate. Sensitivity should be a floating-point number within 0 and 1.


picovoice.Picovoice.WakeWordCallback

var WakeWordCallback WakeWordCallbackType

Function to be called once the wake word has been detected.


picovoice.Picovoice.Delete()

func (picovoice *Picovoice) Delete() error

Releases resources acquired by Picovoice.

Returns

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

picovoice.Picovoice.Init()

func (picovoice *Picovoice) Init() error

Init function for Picovoice. Must be called before attempting Process.

Returns

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

picovoice.Picovoice.Process()

func (picovoice *Picovoice) Process(pcm []int16) error

Process a frame of pcm audio with the Picovoice platform. Invokes user-defined callbacks upon detection of wake word and completion of follow-on command inference.

Parameters

  • pcm []int16 : A frame of audio samples.

Returns

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

picovoice.PicovoiceError

type PicovoiceError struct

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


picovoice.PicovoiceError.Error()

func (e *PicovoiceError) Error() string

Formats the PicovoiceError into a string.

Returns

  • string : Formatted error string.

picovoice.PvStatus

type PvStatus struct

Status return codes from the Picovoice libraries. 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
)

picovoice.WakeWordCallbackType

type WakeWordCallbackType func()

Callback for when a wake word has been detected.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Picovoice Platform — Go API
  • picovoice.FrameLength
  • picovoice.SampleRate
  • picovoice.PorcupineVersion
  • picovoice.RhinoVersion
  • picovoice.Version
  • picovoice.InferenceCallbackType
  • picovoice.NewPicovoice()
  • picovoice.Picovoice
  • AccessKey
  • ContextInfo
  • ContextPath
  • InferenceCallback
  • KeywordPath
  • PorcupineLibraryPath
  • PorcupineModelPath
  • PorcupineSensitivity
  • EndpointDurationSec
  • RequireEndpoint
  • RhinoLibraryPath
  • RhinoModelPath
  • RhinoSensitivity
  • WakeWordCallback
  • Delete()
  • Init()
  • Process()
  • picovoice.PicovoiceError
  • Error()
  • picovoice.PvStatus
  • picovoice.WakeWordCallbackType
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.