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
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()
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.