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

Audio Recording
.NET Quick Start

Platforms

  • Linux (x86_64)
  • macOS (x86_64, arm64)
  • Windows (x86_64)
  • BeagleBone
  • NVIDIA Jetson Nano
  • Raspberry Pi (2, 3, 4)

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+:

  • BeagleBone
  • NVIDIA Jetson Nano
  • Raspberry Pi (2, 3, 4)

.NET 6.0+:

  • macOS (arm64)

Quick Start

Setup

  1. Install .NET .

  2. Install the PvRecorder NuGet package in Visual Studio or using the .NET CLI:

dotnet add package PvRecorder

Usage

Initialize and begin recording:

using Pv;
PvRecorder recorder = PvRecorder.Create(frameLength: 512);
recorder.Start();

Read a frame of audio:

while (true) {
short[] frame = recorder.Read();
// do something with audio frame
}

To stop recording:

recorder.Stop();

Once you are done, free the used resources. You do not have to call Stop() before Dispose():

recorder.Dispose();

To have resources freed immediately after use without explicitly calling Dispose(), wrap PvRecorder in a using statement:

using (PvRecorder recorder = PvRecorder.Create(frameLength: 512)) {
// PvRecorder usage
}

Selecting an Audio Device

To print a list of available audio devices:

string[] devices = PvRecorder.GetAvailableDevices();

The index of the device in the returned list can be used in Create() to select that device for audio capture:

PvRecorder recorder = PvRecorder.Create(
frameLength: 512,
deviceIndex: 2);

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

  1. Clone the repository:
git clone --recurse-submodules https://github.com/Picovoice/pvrecorder.git
  1. Build the project:
cd pvrecorder/demo/dotnet
dotnet build

Usage

To show the available audio devices run:

dotnet run -- --show_audio_devices

To run the demo, give it a file to record audio to:

dotnet run -- --output_wav_path ${OUTPUT_WAV_FILE}

You can also select the audio device index to use for recording (use --show_audio_devices to see options):

dotnet run -- --output_wav_path ${OUTPUT_WAV_FILE} --audio_device_index ${DEVICE_INDEX}

For more information about our PvRecorder demo, head over to our GitHub repository .

Resources

Package

  • PvRecorder on NuGet

API

  • PvRecorder .NET API Docs

GitHub

  • PvRecorder .NET SDK on GitHub
  • PvRecorder .NET Demo on GitHub

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Audio Recording .NET Quick Start
  • Platforms
  • Requirements
  • Quick Start
  • Setup
  • Usage
  • Selecting an Audio Device
  • Demo
  • Setup
  • Usage
  • Resources
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.