Picovoice Wordmark
Start Building
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 GoiOSJavaNVIDIA JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
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
AndroidCiOSNVIDIA JetsonLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSNVIDIA JetsonLinuxmacOSPythonRaspberry PiWebWindows
AndroidCPythoniOSWeb
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

PvRecorder
Go API

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


pvrecorder.Version

var Version string

The version string of the PvRecorder library.


pvrecorder.SampleRate

var SampleRate int

The audio sample rate used by PvRecorder.


pvrecorder.PvRecorder

type PvRecorder struct

Struct for the PvRecorder


pvrecorder.PvRecorder.FrameLength

var FrameLength int

Length of each frame returned from read command.


pvrecorder.PvRecorder.DeviceIndex

var DeviceIndex int

Index of the audio device to use for recording.


pvrecorder.PvRecorder.BufferedFramesCount

var BufferedFramesCount int

Number of audio frames buffered internally for reading - i.e. internal circular buffer will be of size FrameLength * BufferedFramesCount. If this value is too low, buffer overflows could occur and audio frames could be dropped. A higher value will increase memory usage.


pvrecorder.PvRecorder.Init()

func (pvRecorder *PvRecorder) Init() error

Init function for PvRecorder. Must be called before trying to record audio.

Returns

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

pvrecorder.PvRecorder.Delete()

func (pvRecorder *PvRecorder) Delete()

Releases resources acquired by PvRecorder.


pvrecorder.PvRecorder.Start()

func (pvRecorder *PvRecorder) Start() error

Starts recording and buffering audio frames.

Returns

  • error : Error produced while trying to start recording. nil if no error was encountered.

pvrecorder.PvRecorder.Stop()

func (pvRecorder *PvRecorder) Stop() error

Stops recording audio.

Returns

  • error : Error produced while trying to stop recording. nil if no error was encountered.

pvrecorder.PvRecorder.Read()

func (pvRecorder *PvRecorder) Read() ([]int16, error)

Reads a frame of audio.

Returns

  • []int16 : An audio frame with size FrameLength.
  • error : Error produced while trying to read audio frame. nil if no error was encountered.

pvrecorder.PvRecorder.SetDebugLogging()

func (pvRecorder *PvRecorder) SetDebugLogging(isDebugLoggingEnabled bool)

Enables or disables debug logging for PvRecorder. Debug logs will indicate when there are overflows in the internal frame buffer and when an audio source is generating frames of silence.

Parameters

  • isDebugLoggingEnabled bool : Boolean indicating whether the debug logging is enabled or disabled.

pvrecorder.PvRecorder.IsRecording()

func (pvRecorder *PvRecorder) IsRecording() bool

Whether the recorder is currently recording audio or not.

Returns

  • bool : Boolean value indication if the instance is recording.

pvrecorder.PvRecorder.GetSelectedDevice()

func (pvRecorder *PvRecorder) GetSelectedDevice() string

Current selected audio input device name

Returns

  • string : The name of the audio device the instance is currently using.

pvrecorder.NewPvRecorder()

func NewPvRecorder(frameLength int) PvRecorder

Creates a PvRecorder struct with default parameters.

Parameters

  • frameLength int : The length of audio frame to get for each read call.

Returns

  • PvRecorder : An instance of PvRecorder struct.

pvrecorder.GetAvailableDevices()

func GetAvailableDevices() ([]string, error)

Gets the currently available input audio devices.

Returns

  • []string : A list of strings, indicating the names of audio devices.
  • error : Error produced while trying to get available audio devices. nil if no error was encountered.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
PvRecorder Go API
  • pvrecorder.Version
  • pvrecorder.SampleRate
  • pvrecorder.PvRecorder
  • FrameLength
  • DeviceIndex
  • BufferedFramesCount
  • Init()
  • Delete()
  • Start()
  • Stop()
  • Read()
  • SetDebugLogging()
  • IsRecording()
  • GetSelectedDevice()
  • pvrecorder.NewPvRecorder()
  • pvrecorder.GetAvailableDevices()
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
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.