docfx/index.md
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.
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.