Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

PvRecorder
Rust API

Rust SDKs will no longer be maintained after July 15, 2025. If you plan to use the PvRecorder Rust SDK for commercial purposes, please contact us.

API Reference for the PvRecorder Rust SDK (crates.io).


pv_recorder::PvRecorder

pub struct PvRecorder

Struct representing the PvRecorder object.


pv_recorder::PvRecorder.start()

pub fn start(&self) -> Result<(), PvRecorderError>

Starts recording and buffering audio frames.

Returns

  • Result<(), PvRecorderError>: If Err, a PvRecorderError.

pv_recorder::PvRecorder.stop()

pub fn stop(&self) -> Result<(), PvRecorderError>

Stops recording audio.

Returns

  • Result<(), PvRecorderError>: If Err, a PvRecorderError.

pv_recorder::PvRecorder.read()

pub fn read(&self) -> Result<Vec<i16>, PvRecorderError>

Synchronous call to read a frame of audio.

Returns

  • Result<Vec<i16>, PvRecorderError>: If Ok, A frame with size frame_length. If Err, a PvRecorderError.

pv_recorder::PvRecorder.set_debug_logging()

pub fn set_debug_logging(&self, is_debug_logging_enabled: bool)

Enable or disable 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

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

pv_recorder::PvRecorder.frame_length()

pub fn frame_length(&self) -> usize

The length of audio frame given at each read() call.

Returns

  • usize : The length of audio frame.

pv_recorder::PvRecorder.is_recording()

pub fn is_recording(&self) -> bool

Whether the recorder is currently recording audio or not.

Returns

  • bool : Whether the recorder is currently recording audio or not.

pv_recorder::PvRecorder.sample_rate()

pub fn sample_rate(&self) -> u32

The audio sample rate used by PvRecorder.

Returns

  • u32 : Sample rate used by the engine.

pv_recorder::PvRecorder.selected_device()

pub fn selected_device(&self) -> String

The audio device that the given PvRecorder instance is using.

Returns

  • String : Audio device string.

pv_recorder::PvRecorder.version()

pub fn version(&self) -> String

PvRecorder version.

Returns

  • String : Version string.

pv_recorder::PvRecorderBuilder

pub struct PvRecorderBuilder

Builder class for creating an instance of PvRecorder with a variety of properties.


pv_recorder::PvRecorderBuilder.new()

pub fn new(frame_length: i32) -> Self

Creates a PvRecorderBuilder.

Parameters

  • frame_length i32 : The length of audio frame to get for each read call.

Returns

  • PvRecorderBuilder : A new Builder object.

pv_recorder::PvRecorderBuilder.frame_length()

pub fn frame_length(&mut self, frame_length: i32) -> &mut Self

Modifies the frame_length of a PvRecorderBuilder object.

Parameters

  • frame_length i32 : The length of audio frame to get for each read call.

Returns

  • PvRecorderBuilder : The modified Builder object.

pv_recorder::PvRecorderBuilder.device_index()

pub fn device_index(&mut self, device_index: i32) -> &mut Self

Modifies the device_index of a PvRecorderBuilder object.

Parameters

  • device_index i32 : The index of the audio device to use. A value of (-1) will resort to default device.

Returns

  • PvRecorderBuilder : The modified Builder object.

pv_recorder::PvRecorderBuilder.buffered_frames_count()

pub fn buffered_frames_count(&mut self, buffered_frames_count: i32) -> &mut Self

Modifies the buffered_frames_count of a PvRecorderBuilder object. This is the number of audio frames buffered internally for reading - i.e. internal circular buffer will be of size frame_length * buffered_frames_count. If this value is too low, buffer overflows could occur and audio frames could be dropped. A higher value will increase memory usage.

Parameters

  • buffered_frames_count i32 : The number of audio frames buffered internally for reading.

Returns

  • PvRecorderBuilder : The modified Builder object.

pv_recorder::PvRecorderBuilder.library_path()

pub fn library_path(&mut self, library_path: &Path) -> &mut Self

Overrides the default library_path of a PvRecorderBuilder object.

Parameters

  • library_path &Path : Path to the PvRecorder library file.

Returns

  • PvRecorderBuilder : The modified Builder object.

pv_recorder::PvRecorderBuilder.init()

pub fn init(&self) -> Result<PvRecorder, PvRecorderError>

Creates an instance of PvRecorder from the PvRecorderBuilder object.

Returns

  • Result<PvRecorder, PvRecorderError> : If Ok, an initialized instance of PvRecorder. If Err, and instance of PvRecorderError detailing the error that was encountered.

pv_recorder::PvRecorderBuilder.get_available_devices()

pub fn get_available_devices(&self) -> Result<Vec<String>, PvRecorderError>

Gets the list of available audio devices that can be used for recording.

Returns

  • Result<Vec<String>, PvRecorderError>: If Ok, A list of strings, indicating the names of audio devices.. If Err, a PvRecorderError.

pv_recorder::PvRecorderError

pub struct PvRecorderError

An error type describing any errors encountered by the PvRecorder SDK.


pv_recorder::PvRecorderError.status

pub status: PvRecorderErrorStatus

Type of error encountered.


pv_recorder::PvRecorderError.message

pub status: Option<String>

Message detailing the cause of the error.


pv_recorder::PvRecorderError.new()

pub fn new(status: PvRecorderErrorStatus, message: &str) -> Self

Creates a new instance of PvRecorderError.

Parameters

  • status PvRecorderErrorStatus : Type of error encountered.
  • message &str : Message detailing the cause of the error.

pv_recorder::PvRecorderErrorStatus

pub enum PvRecorderErrorStatus {
LibraryError(PvStatus),
LibraryLoadError,
FrameLengthError,
ArgumentError,
}

Enum describing possible error types returned from the PvRecorder Rust SDK.


pv_recorder::PvRecorderStatus

pub enum PvRecorderStatus {
SUCCESS,
OUT_OF_MEMORY,
IO_ERROR,
INVALID_ARGUMENT,
STOP_ITERATION,
KEY_ERROR,
INVALID_STATE,
RUNTIME_ERROR,
ACTIVATION_ERROR,
ACTIVATION_LIMIT_REACHED,
ACTIVATION_THROTTLED,
ACTIVATION_REFUSED,
}

Error codes returned from the PvRecorder library.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
PvRecorder Rust API
  • pv_recorder::PvRecorder
  • start()
  • stop()
  • read()
  • set_debug_logging()
  • frame_length()
  • is_recording()
  • sample_rate()
  • selected_device()
  • version()
  • pv_recorder::PvRecorderBuilder
  • new()
  • frame_length()
  • device_index()
  • buffered_frames_count()
  • library_path()
  • init()
  • get_available_devices()
  • pv_recorder::PvRecorderError
  • status
  • message
  • new()
  • pv_recorder::PvRecorderErrorStatus
  • pv_recorder::PvRecorderStatus
Voice AI
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.