NAudio 3.4.0-preview.1
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 what you need to play, record and manipulate audio on Windows, 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
On any target framework (net9.0 or later, with or without -windows):
- 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 (plus WinRT live MIDI I/O when your project targets
net9.0-windows10.0.19041.0or later) - 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.Wasapi and NAudio.WinMM are Windows-only at runtime. They're marked [SupportedOSPlatform("windows")], so the platform compatibility analyzer (CA1416) flags unguarded calls from code that isn't Windows-specific. AudioFileReader reads PCM/float WAV and AIFF everywhere, and uses Media Foundation (MP3, AAC, WMA, FLAC…) and ACM (compressed WAV) when running on Windows.
If you're targeting Linux or macOS, you probably want the individual packages (NAudio.Core plus NAudio.Alsa, NAudio.MacOS or NAudio.SoundFile) 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.Asio | Windows | Low-latency multichannel playback and capture through ASIO drivers (AsioDevice, AsioOut) |
| NAudio.Dmo | Windows | DirectSoundOut, DMO effects, and the DMO MP3 decoder and resampler |
| NAudio.WinForms | Windows (netX.0-windows) |
Windows Forms controls, and the window-callback WaveOutWindow / WaveInWindow |
| 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 (playback engine Windows-only) | Opinionated helpers — playback engine, capture mixing, ID3 tags |
NAudio 3.0–3.2 included NAudio.Asio, NAudio.Dmo and NAudio.WinForms in this meta-package on Windows target frameworks. If you're upgrading and use any of them, add the package reference.
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.
Showing the top 20 packages that depend on NAudio.
| Packages | Downloads |
|---|---|
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and Linux.
|
22 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and eventually Linux.
|
22 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and eventually Linux.
|
20 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and Linux.
|
20 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and eventually Linux.
|
18 |
- Hardened file parsers against malformed input: SoundFont files with chunk sizes past the end of the file, or out-of-range/out-of-order preset, instrument, bag, generator or sample indices now throw
InvalidDataExceptioninstead of attempting multi-GB allocations or throwingIndexOutOfRangeException/OverflowException/ArgumentException; WAV cue chunks with a corrupt cue-point count no longer over-allocate or throw; an MP3 whose first frame is too small for the Xing/Info fields it flags is treated as having no Xing header instead of throwing from theMp3FileReaderconstructor (#1502) SoundFontSamplerskips SoundFont regions with a zero (or out-of-range) sample rate instead of throwing on every note-on (#1502)MidiFilenow pairs note offs with note ons in constant time, so files with many held notes no longer load in quadratic time (#1502)WaveInBuffer,WaveOutBufferandMidiInno longer free buffers the driver still owns when unprepare reports they are still in use, andMidiInbounds sysex reads by the buffer length;Vst3Moduleloads plug-in binaries by full path (#1502)- Breaking: SFZ
#includeandsample=paths that are absolute or UNC/network paths (e.g.\\server\share\x.wav, which on Windows can leak credentials) are now refused; relative paths, including..\Samples\..., still work.FileSfzIncludeResolverandFileSfzSampleLoadergain arootDirectoryconstructor argument to sandbox untrusted SFZ files to a directory, and the shared rules are exposed asSfzFilePath.Resolve.SfzParsernow limits#includecount and#define/#includeexpansion size, and include files are capped at 16 MB (#1501) - Fixed native buffer overruns and use-after-free bugs:
WasapiOutcould copy past the WASAPI render buffer if anIWaveProviderover-reported its read count; DMOMediaBuffer.Lengthaccepted values larger than the buffer;MediaObject.GetInputType/GetOutputType/GetOutputCurrentTypereturned media types pointing at freed memory (GetWaveFormat()on them now throwsInvalidOperationException);Vst3Pluginoverflowed its native buffers for a hugemaxBlockSize; macOSCoreAudioPlayercould write past the HAL buffer list when the device's stream count shrank;MediaFoundationReadercouldPropVariantClearuninitialised memory for media without a duration (#1501) - macOS wrappers (preview): Fixed Extended Audio File Services reader/writer settings contract to be more accurate after the nullable change landed in #1486. New APIs in the
AudioFileLibraryInformationclass were also added. (#1500) - Breaking:
WaveFormat.FromFormatChunk(and soWaveFileReader.WaveFormat,AudioFileReaderand anything else reading a WAV fmt chunk) now returns the most specific format type instead of always returning aWaveFormatExtraData— aWaveFormatExtensible,AdpcmWaveFormat,Gsm610WaveFormatorMp3WaveFormatwhere the encoding and extra data allow, a plainWaveFormatwhere there is no extra data, and aWaveFormatExtraDataonly for an encoding with no dedicated subclass. This is the same choiceWaveFormat.MarshalFromPtrmakes, so a format read from a file and the same format read from a native pointer now come back as the same type. Code casting a reader'sWaveFormattoWaveFormatExtraData, or unpacking aSubFormatGUID out of itsExtraData, should pattern-match onWaveFormatExtensible(or callAsStandardWaveFormat()) instead (#1497) WaveFormat.MarshalFromPtrnow decodes a WAVE_FORMAT_MPEGLAYER3 block into anMp3WaveFormatrather than aWaveFormatExtraDatawhen its cbSize accounts for the 12 MPEGLAYER3WAVEFORMAT bytes (#1497)- A
WaveFormatsubclass decoded from a format block now reports theExtraSizeitsSerializeactually writes, so a block whose cbSize over-reported the extension (drivers pad it, and a fmt chunk can be padded too) no longer round-trips into a fmt chunk shorter than the cbSize it advertises (#1497) - Added
BufferedWaveProvider.CompleteAdding()andIsAddingCompleted, so a producer can end the stream:Readdrains the buffer, returns one unpadded short read even withReadFully, then 0. AddedUnderrunSilenceBytes,DiscardedBytesandResetCounters()to show silence inserted on underrun and audio dropped on overflow (#1492) - Added
MixingSampleProvider.CompleteAdding()andIsAddingCompleted, so aReadFullymixer ends once its current inputs have ended;AddMixerInputafter it throwsInvalidOperationException(#1492) WdlResamplingSampleProvidernow defaults to sinc resampling - a newWdlResamplerQualityconstructor argument selects the algorithm, and the default is nowSinc64(64-tap windowed sinc) instead of linear interpolation with IIR filtering, which lost about 2 dB at 10 kHz and 20 dB at 18 kHz and let aliasing through. This is a behaviour change: output samples differ, CPU use is a little higher and about 0.8 ms of latency is added. PassWdlResamplerQuality.Linearto keep the old output exactly. See Resampling (#1491)- Added
WdlResamplingSampleProvider.HoldBackOnShortReadsfor sources that return short reads mid-stream (e.g.BufferedWaveProviderwithReadFullyoff): in sinc mode it holds back the last few output samples of a short read until their input arrives, instead of computing them from silence.WdlResampler.ResampleOutgains a matching overload with aflushargument (#1491) NAudio.Asiois now Native AOT compatible. The driver binding no longer uses reflection or runtime marshalling: the IASIO vtable is bound with typed function pointers, and channel info, clock sources and callbacks go through blittable structs. The public API is unchanged. A new test drives the binding against an in-process fake driver, and CI runs it as a Native AOT executable. Also fixedAsioDriver.DisposeBuffersfreeing its callback table twice when called again, e.g. byReleaseDriverafter a failedAsioDevice.Reinitialize(#1487)- New package: NAudio.Nam - native C# inference for Neural Amp Modeler captures. Loads A2 (A2-Lite and A2-Full), A1 WaveNet and LSTM
.nammodels and runs them as an allocation-freeNamEffect(zero latency at the model's sample rate, with built-in sinc resampling at other rates), or throughNamProcessorfor ASIO callbacks. Output matches NeuralAmpModelerCore to within float rounding. SeeDocs/NeuralAmpModeler.md(#1498) - Added
CabinetEffect, a zero-latency guitar/bass cabinet simulator: it loads an impulse response from a WAV file at any sample rate, resamples it to the stream rate, and optionally trims its silent tail and normalises its level (#1498) - Added a zero-latency mode to
PartitionedConvolver(new constructor overload) andConvolutionReverbEffect(ZeroLatency), which applies the first partition of the impulse response directly so there is no partition delay (#1498) PartitionedConvolver(and soConvolutionReverbEffect) is about 2-3x faster: the frequency-domain multiply-accumulate is now vectorised (#1498)- Fixed
WdlResampler(and soWdlResamplingSampleProvider) allocating a new input buffer on most calls when the block size varied; the buffer now only grows, so steady-state resampling is allocation-free in both output-driven and input-driven mode (#1498)
.NET 9.0
- NAudio.Core (>= 3.4.0-preview.1)
- NAudio.Midi (>= 3.4.0-preview.1)
- NAudio.Wasapi (>= 3.4.0-preview.1)
- NAudio.WinMM (>= 3.4.0-preview.1)
| Version | Downloads | Last updated |
|---|---|---|
| 3.4.0-preview.1 | 9 | 10/24/2026 |
| 3.3.0 | 8 | 10/20/2026 |
| 3.3.0-preview.1 | 14 | 10/18/2026 |
| 3.2.0 | 11 | 10/15/2026 |
| 3.2.0-preview.1 | 11 | 10/13/2026 |
| 3.1.1-preview.2 | 13 | 09/22/2026 |
| 3.1.1-preview.1 | 14 | 09/10/2026 |
| 3.1.0 | 12 | 09/07/2026 |
| 3.1.0-preview.2 | 12 | 09/06/2026 |
| 3.1.0-preview.1 | 15 | 09/04/2026 |
| 3.0.2-preview.2 | 12 | 09/03/2026 |
| 3.0.2-preview.1 | 18 | 08/20/2026 |
| 3.0.1 | 15 | 08/18/2026 |
| 3.0.1-preview.1 | 17 | 08/18/2026 |
| 3.0.0 | 17 | 08/16/2026 |
| 3.0.0-preview.20 | 19 | 08/10/2026 |
| 3.0.0-preview.19 | 18 | 07/29/2026 |
| 3.0.0-preview.18 | 20 | 07/18/2026 |
| 3.0.0-preview.17 | 20 | 07/15/2026 |
| 3.0.0-preview.16 | 15 | 07/01/2026 |
| 3.0.0-preview.15 | 6 | 09/25/2026 |
| 3.0.0-preview.14 | 6 | 09/25/2026 |
| 3.0.0-preview.10 | 6 | 09/08/2026 |
| 3.0.0-preview.9 | 4 | 09/25/2026 |
| 3.0.0-preview.8 | 3 | 09/25/2026 |
| 3.0.0-preview.7 | 6 | 09/21/2026 |
| 3.0.0-preview.6 | 10 | 09/19/2026 |
| 3.0.0-preview.5 | 2 | 10/20/2026 |
| 3.0.0-preview.4 | 3 | 09/25/2026 |
| 3.0.0-preview.3 | 7 | 09/18/2026 |
| 3.0.0-preview.2 | 4 | 09/16/2026 |
| 2.4.0 | 14 | 08/28/2026 |
| 2.3.0 | 24 | 05/30/2026 |
| 2.2.1 | 21 | 05/30/2026 |
| 2.2.0 | 24 | 05/30/2026 |
| 2.1.0 | 18 | 05/30/2026 |
| 2.1.0-beta.1 | 19 | 05/30/2026 |
| 2.0.1 | 23 | 05/30/2026 |
| 2.0.0 | 23 | 05/30/2026 |
| 2.0.0-beta2 | 20 | 05/30/2026 |
| 2.0.0-beta1 | 18 | 05/30/2026 |
| 1.10.0 | 23 | 05/29/2026 |
| 1.9.0 | 19 | 05/30/2026 |
| 1.9.0-preview2 | 19 | 05/30/2026 |
| 1.9.0-preview1 | 19 | 05/30/2026 |
| 1.8.5 | 18 | 05/30/2026 |
| 1.8.4 | 21 | 05/30/2026 |
| 1.8.3 | 18 | 05/30/2026 |
| 1.8.2 | 19 | 05/30/2026 |
| 1.8.1 | 20 | 05/30/2026 |
| 1.8.0 | 4 | 09/21/2026 |
| 1.7.3 | 22 | 05/30/2026 |
| 1.7.2 | 19 | 05/30/2026 |
| 1.7.1 | 19 | 05/30/2026 |
| 1.7.0 | 19 | 05/30/2026 |
| 1.7.0-beta01 | 21 | 05/30/2026 |
| 1.7.0-alpha06 | 7 | 09/10/2026 |
| 1.7.0-alpha05 | 8 | 09/19/2026 |
| 1.7.0-alpha04 | 8 | 09/08/2026 |
| 1.7.0-alpha03 | 21 | 05/29/2026 |
| 1.7.0-alpha02 | 5 | 09/08/2026 |
| 1.7.0-alpha01 | 4 | 09/08/2026 |
| 1.6.0 | 22 | 05/30/2026 |
| 1.5.7-beta | 8 | 09/20/2026 |
| 1.5.6-beta | 2 | 09/24/2026 |
| 1.5.5-beta | 4 | 09/24/2026 |
| 1.5.4-beta | 5 | 09/18/2026 |
| 1.5.3-beta | 3 | 09/24/2026 |
| 1.5.2-beta | 3 | 09/24/2026 |
| 1.5.1-beta | 4 | 09/24/2026 |
| 1.5.0 | 7 | 09/10/2026 |