Audio Recording
C Quick Start
Platforms
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Raspberry Pi (Zero, 3, 4, 5)
Requirements
- CMake 3.4+.
- C99 compatible compiler.
- Windows: MinGW.
Quick Start
Setup
Include the public header files (pv_recorder.h
and pv_circular_buffer.h
).
Usage
- Create a PvRecorder object:
- Start recording audio:
- Read frames of audio from the recorder:
- Stop recording:
- Release resources used by PvRecorder:
Selecting an Audio Device
To print a list of available audio devices:
The index of the device in the returned list can be used in pv_recorder_init()
to select that device for recording.
Demo
For the PvRecorder C SDK, we offer a demo application that demonstrates how use PvRecorder to record audio to an output audio file in WAV format.
Setup
- Clone the repository:
- Build the project:
The {PV_RECORDER_PLATFORM}
variable will set the compilation flags for the given platform. Exclude this variable to get a list of possible values.
Usage
To see the usage options for the demo:
Get a list of available audio recording devices:
Record to a file with a given audio device index:
Hit Ctrl+C
to stop recording. If no audio device index (-d
) is provided, the demo will use the system's default recording device.
For more information about our PvRecorder demo, head over to our GitHub repository.