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
Node.js API

API Reference for the Node.js PvRecorder SDK (npmjs).


PvRecorder

class PvRecorder { }

Class for the PvRecorder. PvRecorder can be initialized using the class constructor(). Resources should be cleaned when you are done using the release() method.


PvRecorder.constructor()

PvRecorder.constructor(
frameLength: number,
deviceIndex: number = -1,
bufferedFramesCount: number = 50,
) { }

constructor method for PvRecorder.

Parameters

  • frameLength number : Length of the audio frames to receive per read call.
  • deviceIndex number : The audio device index to use to record audio. A value of (-1) will use machine's default audio device.
  • bufferedFramesCount number : The 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.

Returns

  • PvRecorder: An instance of PvRecorder.

Throws

  • Error: If an error occurs while initializing PvRecorder.

PvRecorder.start()

PvRecorder.start() { }

Starts recording and buffering audio frames.

Throws

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

PvRecorder.stop()

PvRecorder.stop() { }

Stops recording audio.

Throws

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

PvRecorder.read()

async PvRecorder.read(): Promise<Int16Array> { }

Asynchronous call to read a frame of audio data.

Returns

  • Promise<Int16Array> : An audio frame with size frameLength.

Throws

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

PvRecorder.readSync()

PvRecorder.readSync(): Int16Array { }

Synchronous call to read a frame of audio data.

Returns

  • Int16Array : An audio frame with size frameLength.

Throws

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

PvRecorder.setDebugLogging()

PvRecorder.setDebugLogging(isDebugLoggingEnabled: boolean) { }

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.


PvRecorder.getSelectedDevice()

PvRecorder.getSelectedDevice(): string { }

Returns the name of the selected device used to capture audio.

Returns

  • string : The name of the selected audio device.

PvRecorder.release()

PvRecorder.release() { }

Releases resources acquired by PvRecorder.


PvRecorder.frameLength

PvRecorder.frameLength: number

Length of the audio frames to receive per read call.


PvRecorder.sampleRate

PvRecorder.sampleRate: number

Audio sample rate used by PvRecorder.


PvRecorder.version

PvRecorder.version: string

Version of the PvRecorder.


PvRecorder.isRecording

PvRecorder.isRecording: boolean

Whether PvRecorder is currently recording audio or not.


PvRecorder.getAvailableDevices()

static PvRecorder.getAvailableDevices(): string[] { }

Gets the list of available audio devices.

Returns

  • string[] : An array of the available device names.

Throws

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

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
PvRecorder Node.js API
  • PvRecorder
  • constructor()
  • start()
  • stop()
  • read()
  • readSync()
  • setDebugLogging()
  • getSelectedDevice()
  • release()
  • frameLength
  • sampleRate
  • version
  • isRecording
  • PvRecorder.getAvailableDevices()
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.