Picovoice Platform
Go API
API Reference for the Picovoice Go SDK (pkg.go.dev).
picovoice.FrameLength
Number of audio samples per frame.
picovoice.SampleRate
Audio sample rate accepted by Picovoice.
picovoice.PorcupineVersion
Version of Porcupine being used by the Picovoice SDK.
picovoice.RhinoVersion
Version of Rhino being used by the Picovoice SDK.
picovoice.Version
Picovoice version.
picovoice.InferenceCallbackType
Callback for when Rhino has made an inference. Receives a RhinoInference object.
picovoice.NewPicovoice()
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
Struct for the Picovoice End-to-End Voice Platform.
picovoice.Picovoice.AccessKey
AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
picovoice.Picovoice.ContextInfo
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
Absolute path to the Rhino context file (.rhn
).
picovoice.Picovoice.InferenceCallback
Function to be called once Rhino has an inference ready.
picovoice.Picovoice.KeywordPath
Path to Porcupine keyword file (.ppn
).
picovoice.Picovoice.PorcupineLibraryPath
Absolute path to Porcupine's dynamic library.
picovoice.Picovoice.PorcupineModelPath
Path to Porcupine model file (.pv
).
picovoice.Picovoice.PorcupineSensitivity
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
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
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
Absolute path to Rhino's dynamic library.
picovoice.Picovoice.RhinoModelPath
Path to Rhino model file (.pv
).
picovoice.Picovoice.RhinoSensitivity
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
Function to be called once the wake word has been detected.
picovoice.Picovoice.Delete()
Releases resources acquired by Picovoice.
Returns
error
: Error produced by the Picovoice SDK.nil
if no error was encountered.
picovoice.Picovoice.Init()
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()
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.Picovoice.Reset()
Resets the internal state of Picovoice. It should be called before processing a new stream of audio or when Picovoice was stopped while processing a stream of audio.
Returns
error
: Error produced by the Picovoice SDK.nil
if no error was encountered.
picovoice.PicovoiceError
Custom error type for errors produced from the Picovoice Go SDK.
picovoice.PicovoiceError.Error()
Formats the PicovoiceError
into a string.
Returns
string
: Formatted error string.
picovoice.PvStatus
Status return codes from the Picovoice libraries. Possible values are:
picovoice.WakeWordCallbackType
Callback for when a wake word has been detected.