NAudio
NAudio is an open source .NET audio library β playback and recording, file readers and writers, MIDI, DSP and effects, with platform-specific backends auto-selected by target framework.
Install
| Product | Versions |
|---|---|
| .NET |
README
NAudio
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.
What it pulls in
Always, on every target framework:
- NAudio.Core β the format-independent core:
WaveStream,IWaveProvider/ISampleProvider, WAV and AIFF readers and writers, mixing, resampling, DSP, and theNAudio.Effectsframework - NAudio.Midi β the MIDI event model and Standard MIDI File reading and writing
Additionally, on a Windows target framework:
- NAudio.Wasapi β WASAPI playback, capture and loopback (
WasapiPlayer/WasapiRecorder), plus Media Foundation codecs - NAudio.WinMM β
WaveOut/WaveIn, classic MIDI I/O, ACM codecs and mixer controls viawinmm.dll - NAudio.Asio β low-latency multichannel playback and capture through ASIO drivers
- NAudio.Dmo β DMO effects, the DMO MP3 decoder and resampler, and
DirectSoundOut - NAudio.WinForms β Windows Forms controls, and the window-callback
WaveOutWindow/WaveInWindow
On 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.
Optional packages
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 |
Getting started
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);
}
- Documentation site β tutorials and the full API reference
- GitHub repository β source, issues, and the demo applications (
NAudioDemo,NAudioWpfDemo) - Migrating from NAudio 2 to NAudio 3 β every breaking change, with before/after code
License
MIT. See the project site for source, issues, and contribution guidelines.
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.