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

API Reference for the PvRecorder Python SDK (PyPI).


pvrecorder.PvRecorder

class PvRecorder(object)

Class for the PvRecorder audio recorder. PvRecorder is initialized via __init__() method.


pvrecorder.PvRecorder.is_recording

self.is_recording: bool

Whether the recorder is currently recording audio or not.


pvrecorder.PvRecorder.selected_device

self.selected_device: str

The audio device that the given PvRecorder instance is using.


pvrecorder.PvRecorder.version

self.version: str

The version string of the PvRecorder library.


pvrecorder.PvRecorder.frame_length

self.frame_length: int

Gets the frame length matching the value given to __init__().


pvrecorder.PvRecorder.sample_rate

self.sample_rate: int

The audio sample rate used by PvRecorder.


pvrecorder.PvRecorder.__init__()

def __init__(
self,
frame_length: int,
device_index: int = -1,
buffered_frames_count: int = 50) -> PvRecorder

__init__ method for PvRecorder.

Parameters

  • frame_length int : The length of audio frame to get for each read call.
  • device_index int : The index of the audio device to use. A value of (-1) will resort to default device.
  • buffered_frames_count int : 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 audio frames could be dropped. A higher value will increase memory usage.

Returns

  • PvRecorder: An instance of PvRecorder.

Throws

  • Error: If an error occurs while creating an instance of PvRecorder.

pvrecorder.PvRecorder.delete()

def delete(self) -> None

Releases resources acquired by PvRecorder.


pvrecorder.PvRecorder.start()

def start(self) -> None

Starts recording and buffering audio frames.

Throws

  • Error: If an error occurs while starting audio device.

pvrecorder.PvRecorder.stop()

def stop(self) ->None

Stops recording audio.

Throws

  • Error: If an error occurs while stopping audio device.

pvrecorder.PvRecorder.read()

def read(self) -> List[int]

Synchronous call to read a frame of audio.

Returns

  • int: A frame with size frame_length matching the value given to __init__().

Throws

  • Error: If an error occurs while reading audio frame.

pvrecorder.PvRecorder.set_debug_logging()

def set_debug_logging(self, is_debug_logging_enabled) -> None

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.

pvrecorder.PvRecorder.get_available_devices()

PvRecorder.get_available_devices() -> List[str]

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

Returns

  • List[str]: A list of strings, indicating the names of audio devices.

Throws

  • Error: If an error occurs while getting available devices.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
PvRecorder Python API
  • pvrecorder.PvRecorder
  • is_recording
  • selected_device
  • version
  • frame_length
  • sample_rate
  • __init__()
  • delete()
  • start()
  • stop()
  • read()
  • set_debug_logging()
  • get_available_devices()
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.