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
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

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.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
}

Struct which contains a transcribed word and their associated metadata.

  • Word string : Transcribed word.
  • startSec number : Start of word in seconds.
  • endSec number : End of word in seconds.
  • confidence number : Transcription confidence. It is a number within [0, 1].

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
  • Delete()
  • Init()
  • Process()
  • ProcessFile()
  • leopard.NewLeopard()
  • LeopardWord
  • leopard.LeopardError
  • Error()
  • leopard.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.