Audio Recording
.NET Quick Start
Platforms
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Raspberry Pi (3, 4, 5)
Requirements
.NET Framework 4.6.1+ / .NET Standard 2.0+ / .NET Core 3.0+:
- Windows (x86_64)
.NET Standard 2.0+ / .NET Core 3.0+:
- Linux (x86_64)
- macOS (x86_64)
.NET Core 3.0+:
- Raspberry Pi (3, 4, 5)
.NET 6.0+:
- macOS (arm64)
Quick Start
Setup
Install .NET.
Install the PvRecorder NuGet package in Visual Studio or using the .NET CLI:
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 Dispose()
:
To have resources freed immediately after use without explicitly calling Dispose()
, wrap PvRecorder
in a using
statement:
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 Create()
to select that device for audio capture:
Demo
For the PvRecorder .NET SDK, we offer a demo application that demonstrates how use PvRecorder to record audio to an output audio file.
Setup
- Clone the repository:
- Build the project:
Usage
To show the available audio devices run:
To run the demo, give it a file to record audio to:
You can also select the audio device index to use for recording (use --show_audio_devices
to see options):
For more information about our PvRecorder demo, head over to our GitHub repository.