src/NAudio/README.md
NAudio is an open source .NET audio library written by Mark Heath and contributors.
This is the main NAudio meta-package. Installing it pulls in everything you need to play, record and manipulate audio on .NET, and adds AudioFileReader — the one-line "just open this audio file" reader that picks the right decoder for you — along with Mp3FileReader.
Requires net9.0 or later. If you need .NET Framework or .NET Standard 2.0, use NAudio 2.x.
Always, on every target framework:
WaveStream, IWaveProvider / ISampleProvider, WAV and AIFF readers and writers, mixing, resampling, DSP, and the NAudio.Effects frameworkAdditionally, on a Windows target framework:
WasapiPlayer / WasapiRecorder), plus Media Foundation codecsWaveOut / WaveIn, classic MIDI I/O, ACM codecs and mixer controls via winmm.dllDirectSoundOutWaveOutWindow / WaveInWindowOn a non-Windows target framework only the cross-platform pieces are referenced. If you only need a subset, reference the individual packages directly rather than this meta-package.
These are not pulled in by the meta-package — add them explicitly if you want them:
| Package | Platform | What it gives you |
|---|---|---|
| NAudio.Sampler | cross-platform | Polyphonic software sampler — SoundFont (.sf2), SFZ and single-sample instruments |
| NAudio.SoundFile | cross-platform | Read and write WAV/AIFF/FLAC/Ogg-Vorbis/Opus/MP3 via libsndfile |
| NAudio.Alsa | Linux | AlsaOut / AlsaIn playback and capture via libasound |
| NAudio.Vst3 | Windows | VST 3 plug-in hosting (preview) — effects and instruments |
| NAudio.Extras | cross-platform (+ Windows extras) | Opinionated helpers — playback engine, capture mixing, ID3 tags |
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);
}
NAudioDemo, NAudioWpfDemo)MIT. See the project site for source, issues, and contribution guidelines.