Audio Recording
Node.js Quick Start
Platforms
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Raspberry Pi (3, 4, 5)
Requirements
- Node.js 14+
- npm
Quick Start
Setup
Install Node.js.
Install the pvrecorder-node npm package:
Usage
Initialize and begin recording:
Read a frame of audio:
To stop recording:
Once you are done, free the used resources. You do not have to call stop()
before release()
:
Selecting an Audio Device
To get a list of available audio devices:
The index of the device in the returned list can be used in the constructor()
to select that device for audio capture:
Demo
For the PvRecorder Node.js SDK, we offer a demo application that demonstrates how use PvRecorder
to record audio to an output audio file.
Setup
Install the PvRecorder demo package:
This package installs command-line utilities for the PvRecorder Nodejs demo.
Usage
Use the --help
flag to see the usage options for the demo:
Run the following to see what devices are available for audio capture:
Run the demo with the desired audio device (or -1 for the default one) and an output file path:
For more information about our PvRecorder demo for Node.js, head over to our GitHub repository.