| _layout | landing |
|---|
NAudio is an open source .NET audio library written by Mark Heath. It provides a comprehensive set of classes for playing, recording, converting and manipulating audio in .NET applications.
- Tutorials — task-focused how-to guides covering playback, recording, codecs, MIDI, visualisation and more.
- API Reference — the full class library reference, generated from the source XML documentation.
- NAudio on NuGet — install the package into your project.
- Source on GitHub — browse the code, demos and issues.
dotnet add package NAudio
Playing an audio file is just a few lines:
using NAudio.Wave;
using var audioFile = new AudioFileReader("myfile.mp3");
using var player = new WasapiPlayerBuilder().Build();
player.Init(audioFile);
player.Play();
while (player.PlaybackState == PlaybackState.Playing)
{
Thread.Sleep(500);
}See the tutorials for many more worked examples.