Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNVIDIA JetsonLinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNVIDIA JetsonLinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact 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
AndroidCiOSNVIDIA JetsonLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSNVIDIA JetsonLinuxmacOSPythonRaspberry PiWebWindows
AndroidCPythoniOSWeb
Introduction
CNVIDIA JetsonLinuxmacOSPythonRaspberry PiWindows
CPython
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
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)
Introduction
AndroidC.NETFlutterlink to GoiOSNodejsPythonReact NativeRustUnityWeb
AndroidC.NETFlutterlink to GoiOSNodejsPythonReact NativeRustUnityWeb
FAQGlossary

Leopard Speech-to-Text
Go API

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


leopard.SampleRate

var SampleRate int

Audio sample rate accepted by Leopard.


leopard.Version

var Version string

Leopard version.


leopard.Leopard

type Leopard struct

Struct for the Leopard Speech-to-Text engine.


leopard.Leopard.AccessKey

var AccessKey string

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

leopard.Leopard.ModelPath

var ModelPath string

Absolute path to the file containing model parameters.

leopard.Leopard.LibraryPath

var LibraryPath string

Absolute path to Leopard's dynamic library.

leopard.Leopard.EnableAutomaticPunctuation

var EnableAutomaticPunctuation bool

Flag to enable automatic punctuation insertion.

leopard.Leopard.EnableDiarization

var EnableDiarization bool

Flag to enable automatic diarization. Set to true to enable speaker diarization, which allows Leopard to differentiate speakers as part of the transcription process. Word metadata will include a speakerTag to identify unique speakers.

leopard.Leopard.Delete()

func (leopard *Leopard) Delete() error

Releases resources acquired by Leopard.

Returns

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

leopard.Leopard.Init()

func (leopard *Leopard) Init() error

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

Returns

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

leopard.Leopard.Process()

func (leopard *Leopard) Process(pcm []int16) (string, []LeopardWord, error)

Processes a given audio data and returns its transcription. The audio needs to have a sample rate equal to .SampleRate and be 16-bit linearly-encoded. This function operates on single-channel audio. If you wish to process data in a different sample rate or format consider using ProcessFile. Returns the inferred transcription.

Returns

  • string : Transcription for the given audio.
  • []LeopardWord : List of words in the transcription and their associated metadata.
  • error : Error produced by the Leopard SDK. nil if no error was encountered.

leopard.Leopard.ProcessFile()

func (leopard *Leopard) ProcessFile(audioPath string) (string, []LeopardWord, error)

Processes a given audio file and returns its transcription. The file needs to have a sample rate equal to or greater than .SampleRate. The supported formats are: FLAC, MP3, Ogg, Opus, Vorbis, WAV, and WebM. Returns the inferred transcription.

Returns

  • string : Transcription for the given audio file.
  • []LeopardWord : List of words in the transcription and their associated metadata.
  • error : Error produced by the Leopard SDK. nil if no error was encountered.

leopard.NewLeopard()

func NewLeopard(accessKey string) Leopard

Creates a Leopard struct with default parameters.

Parameters

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

Returns

  • Leopard : An instance of Leopard struct.

LeopardWord

type LeopardWord struct {
Word string
StartSec float32
EndSec float32
Confidence float32
SpeakerTag int32
}

Struct which contains a transcribed word and their associated metadata.

  • Word string : Transcribed word.
  • StartSec float32 : Start of word in seconds.
  • EndSec float32 : End of word in seconds.
  • Confidence float32 : Transcription confidence. It is a number within [0, 1].
  • SpeakerTag int32 : The speaker tag is -1 if diarization is not enabled during initialization; otherwise, it's a non-negative integer identifying unique speakers, with 0 reserved for unknown speakers.

leopard.LeopardError

type LeopardError struct

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


leopard.LeopardError.Error()

func (e *LeopardError) Error() string

Formats the Leopard error into a string.

Returns

  • string : Formatted error string.

leopard.PvStatus

type PvStatus struct

Status return codes from the Leopard 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
Leopard Speech-to-Text Go API
  • leopard.SampleRate
  • leopard.Version
  • leopard.Leopard
  • AccessKey
  • ModelPath
  • LibraryPath
  • EnableAutomaticPunctuation
  • EnableDiarization
  • Delete()
  • Init()
  • Process()
  • ProcessFile()
  • leopard.NewLeopard()
  • LeopardWord
  • leopard.LeopardError
  • Error()
  • leopard.PvStatus
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Koala Noise Suppression
  • Eagle Speaker RecognitionBETA
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
  • Orca Text-to-SpeechWAITLIST
  • Falcon Speaker DiarizationWAITLIST
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Developer Plan
  • Enterprise Plan
  • Support Add-on
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.