NAudio 3.0.0-preview.8
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, including:
- NAudio.Core — the format-independent core (
WaveStream,ISampleProvider, mixers, resamplers, signal generators, file readers, etc.) - NAudio.Midi — MIDI file reading/writing and event model
- NAudio.WinMM — WaveIn/WaveOut via the Windows Multimedia API (Windows only)
- NAudio.WinForms — Windows Forms controls (fader, pan slider, wave viewer) (Windows only)
- NAudio.Asio — ASIO playback and recording (Windows only)
- NAudio.Wasapi — WASAPI playback, capture, and loopback, plus Media Foundation, ACM, and DMO (Windows only)
On non-Windows target frameworks only the cross-platform pieces (Core + MIDI) are referenced. If you only need a subset, reference the individual packages directly rather than this meta-package.
Getting Started
See the NAudio GitHub repository for documentation, tutorials, and the demo applications (NAudioDemo, NAudioWpfDemo) that show how to use the main features.
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.
|
10 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and eventually Linux.
|
10 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and eventually Linux.
|
9 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and eventually Linux.
|
8 |
|
NDILibDotNetCoreBase
Provides a wrapper to the NDI libraries for Windows, macOS, and Linux.
|
8 |
Breaking changes
IWaveProvider.Readsignature changed fromRead(byte[], int, int)toRead(Span<byte>). Existing callers withbyte[]migrate viasource.Read(buffer.AsSpan(offset, count)); implementations overrideRead(Span<byte>)ISampleProvider.Readsignature changed fromRead(float[], int, int)toRead(Span<float>)(same migration pattern)MidiIn,MidiOut,MidiInCapabilities, andMidiOutCapabilitiesmoved fromNAudio.MiditoNAudio.WinMM— allwinmm.dllinterop now lives in one assemblyMmResult,MmException, andManufacturersmoved fromNAudio.CoretoNAudio.WinMMDirectSoundOutmoved fromNAudio.CoretoNAudio.Dmo(DirectSound has always been Windows-only)- New
NAudio.Dmopackage. DMO effects (echo, chorus, reverb, etc.), the DMO MP3 decoder (DmoMp3FrameDecompressor), the DMO resampler (ResamplerDmoStream), andDirectSoundOutcarved out ofNAudio.Wasapi. Namespaces preserved (NAudio.Dmo,NAudio.Dmo.Effect,NAudio.WaveforDirectSoundOut). Meta-package consumers see no change —NAudio.Dmocomes in transitively. DirectNAudio.Wasapiconsumers who use the DMO/DirectSound types now need an explicit<PackageReference Include="NAudio.Dmo" />. NAudio.Midiis now cross-platform — itsnet9.0target no longer P/Invokeswinmm.dllMidiInMessageEventArgs.TimestampandMidiInSysexMessageEventArgs.Timestampare nowTimeSpan(previouslyintmilliseconds) — preserves full WinRT 100 ns resolution on the WinRT backendMidiIn.CreateSysexBuffersremoved —MidiInnow allocates sysex receive buffers automatically insideStart()WasapiOut,WasapiCapture, andWasapiLoopbackCaptureare now[Obsolete]in favour of the newWasapiPlayer/WasapiRecorderAPIs (the legacy types still ship and continue to work)WasapiOut's embedded DMO resampler removed. Exclusive-mode callers whose source format is not natively supported now get aNotSupportedExceptionfromInitinstead of silent on-the-fly resampling. Resample upstream (e.g. withMediaFoundationResampler), use shared mode (which still auto-converts viaAutoConvertPcm), or switch toWasapiPlayerBuilder. RemovesNAudio.Wasapi's only intra-assembly dependency on DMO.WaveOutandWaveInnow default to event-driven callbacks; the legacy window-based variants are renamedWaveOutWindow/WaveInWindowand live inNAudio.WinFormsWaveInEventArgsnow fires one event per WASAPI packet (previously batched). A newBufferSpanproperty exposes the data without copying through the existingBufferbyte array- Several
Mf*Media Foundation wrapper types are nowinternal— onlyMfActivateandMediaTyperemain public BufferedWaveProviderbuffer duration is now set in the constructor (default 5 seconds);BufferLengthandBufferDurationare read-onlyWaveBufferis deprecated — useMemoryMarshal.CastinsteadMMDevice.AudioClientis[Obsolete]because it created a new instance per access; useMMDevice.CreateAudioClient()PropertyStore[int]now resolvesPropVariantvalues safely; the indexer that returned the rawPropVariantis[Obsolete]- Minimum target framework is now
net9.0(previously supported legacy .NET Framework and .NET Standard 2.0) CueWaveFileReaderremoved - usenew WaveFileReader(...).Chunks.ReadCueList()to get aCueList
New features
- NAudio.SoundFile: new cross-platform
SoundFileReader/SoundFileWriterwrapping libsndfile — reads and writes WAV/AIFF/FLAC/Ogg-Vorbis/Opus/MP3 on Linux, macOS and Windows (the first cross-platform FLAC/Vorbis/Opus encoder in NAudio).SoundFileReaderis aWaveStreamandISampleProvider; both reader and writer also work over aSystem.IO.Stream. Requires a system libsndfile;SoundFileCapabilitiesreports which codecs the build supports (#1289) - WASAPI: new high-level
WasapiPlayerandWasapiRecorderclasses, built viaWasapiPlayerBuilder/WasapiRecorderBuilder. AddsIAudioClient3low-latency support, MMCSS thread priority,IAsyncDisposable, zero-copy buffer access, and process-specific loopback viaWasapiRecorderBuilder.WithProcessLoopback() - ASIO: new
AsioDeviceclass replacingAsioOutas the primary ASIO interface. Adds explicitInitPlayback/InitRecording/InitDuplexmodes, non-contiguous channel selection, per-channelSpan<float>callbacks,Reinitialize()for driver-reset recovery, and per-buffer timing fields (SamplePosition,SystemTimeNanoseconds,Speed, SMPTETimeCode) - ASIO events:
LatenciesChangedandResyncOccurredsurfaced separately; buffer-size changes routed throughDriverResetRequest - Media Foundation:
MediaFoundationEncoder.EncodeToFlacfor lossless FLAC output. The FLAC/ALAC selector now falls back correctly on rate + channels - WinForms:
WaveOutWindowandWaveInWindowavailable as window-callback variants of the modernised event-drivenWaveOut/WaveIn - DSP: new
FftProcessorwith real-input specialisation and precomputed windowing - WAV chunks: new
IWaveChunkInterpreter<T>extension point, with built-in interpreters for cue lists, BWFbext(v1 and v2), and LIST/INFO metadata. RF64 promotion is now an explicitWaveFileWriterOption Span<T>overloads: added onBiQuadFilter.Transform,ALawDecoder.Decode,MuLawDecoder.Decode, andIMp3FrameDecompressor.DecompressFrame(default interface method preserves backward compatibility withNLayerand other third-party decoders)- MIDI: new
WinRTMidiIn/WinRTMidiOutclasses inNAudio.Wasapibacked byWindows.Devices.Midi, withMidiMessageConverterfor interop with the WinRT MIDI types. NewIMidiInput/IMidiOutputinterfaces (with aSend(MidiEvent)extension) let callers write backend-agnostic code; legacyMidiIn/MidiOutalso implement them - MIDI:
MidiFilenow reads RIFF-RMID (.rmi) files by unwrapping the RIFF container and parsing the embedded standard MIDI file (#1236) - ALSA (Linux): new
NAudio.Alsapackage —AlsaOut(IWavePlayer) andAlsaIn(IWaveIn) backed bylibasound, plusAlsaDeviceEnumerator. Linux-only ([SupportedOSPlatform("linux")], AOT-compatible[LibraryImport]); reference it explicitly, it is not part of theNAudiometa-package (#1182)
Demo apps and Test Harnesses
- NAudioConsoleTest: new CLI test harness for driving various NAudio features without the need for GUI. Includes
run-batchfor JSON-driven test plans anddiagnosefor capturing a structured host audio snapshot (OS, ASIO drivers, WASAPI/WinMM/DirectSound devices, NAudio assembly versions). - WPF demos: spectrum analyser rewritten with corrected dB formula (20·log₁₀), log-frequency mapping, real-input full-scale calibration, bars instead of polylines, peak-decay markers, and per-band smoothing. New
LiveWaveformControlwith configurable render styles, vertical scaling, and fill-between rendering - WAV recording demo: added loopback support and a multi-API device combo with provenance embedding
- MIDI In demo: Refresh button for hot-plugged devices, device combos disabled while in use, test MIDI Out plays on channel 1 (was 2), Filter Auto-Sensing on by default, stopping test output now sends note-off so notes don't hang, and cleaner panel disposal
- MfStressTest: Reliability tests for the new Media Foundation interop implementation in NAudio 3.
- Replaced vendored NSpeex (deprecated) with Opus (Concentus) in the network chat demo; added round-trip unit tests
Performance
- Vectorised mix-add and volume kernels via
System.Numerics.Tensors— significantly faster on AVX2 hardware for typical buffer sizes - Eliminated per-
Readallocations inSmbPitchShiftingSampleProvider WaveStream.Read(Span<byte>)overridden directly on every concrete reader (no intermediate byte-array copy)WasapiCapturecapture path is now zero-copy via the native WASAPI buffer spanBiQuadFilterstate and coefficient fields hoisted to locals in batch loops for register retentionMp3FileReadernow builds its table-of-contents lazily on first seek instead of eagerly during construction; thePositionsetter no longer blocks; rapid scrub seeks debounce and silence output- Eliminated per-
Readallocations inResamplerDmoStreamandDmoMp3FrameDecompressor(cached input buffer and output-buffer array) (#971)
Reliability and bug fixes
AcmInterop: serialised allmsacm32P/Invokes process-wide via a reentrant lock — fixes process-killing access violations under concurrent ACM accessAcmStream: fixed double-close in finalizer by zeroing the handle field before closeMediaFoundationReader: informational source-reader flags (STREAMTICK,NEWSTREAM,NativeMediaTypeChanged,AllEffectsRemoved) are now non-fatal instead of aborting readsMediaFoundationReader.Reposition: fixed using a stale field instead of the parameter (seeks would default to stream start)MediaFoundationEncoder: unselectedMediaTypeinstances are now disposed to prevent finalizer-thread COM ref leaksMp3FileReader: fixed false sample-rate-change errors near end of file- MP3 frame parsing: more robust against false frame detections from album art and trailing metadata
MidiFile: preserved running-status across meta events (fixes "Read too far" errors when meta events interrupt running-status sequences)WaveStream.CurrentTimesetter: now lands on a block boundary, preventing garbage audio on seek in custom readersBlockAlignReductionStream.Positionsetter: now validates the incoming value instead of the stale current position, so a block-aligned seek after an arbitrary-length read no longer wrongly throws "Position must be block aligned" (#368)IconExtractor.Extract: now guards against null icon handles fromExtractIconExDirectSoundOut.InitializeDirectSound: wrapped notification setup in try/finally to prevent COM ref leak onSetNotificationPositionsfailure- ASIO: implemented missing
Asio64Bitconversions (Int24LSB and Float32LSB output sample types) - ASIO: fixed byte-order bug in
AsioDriver.GetSamplePositionforAsio64Bitreassembly WdlResampler: backported three upstream Cockos WDL bug fixes (latency calculation,ResampleOutclamping, Blackman-Harris window correction)MediaBufferLease: hardened against out-of-order disposal- Added finalizers to DMO
MediaBufferand theMf*wrappers that hold (RCW, IntPtr) pairs to prevent COM ref leaks WaveFileChunkReader: fixedArgumentExceptionparsing WAV files whose odd-length chunks are followed by non-UTF-8 bytes — the word-alignment pad-byte check no longer decodes viaBinaryReader.PeekChar(), and is now guarded against end-of-stream (#959)- Clarified
BiQuadFilterqparameter docs (#1264) - Removed dead
naudio.codeplex.comlinks from README, MixDiff Help menu, and source comments (CodePlex was shut down by Microsoft in 2017) (#985) AudioClient.Dispose: made idempotent and safe against concurrent/re-entrant disposal — fixes an intermittentNullReferenceExceptionfrom the COM interop layer when a WASAPI capture or playback wrapper is disposed more than once (#1183)WaveFileReader/AiffFileReader: malformed headers that declaredBlockAlign=0now throwInvalidDataExceptionfrom the constructor instead ofDivideByZeroExceptionfrom thePositionsetter (#1254)AiffFileReader.Read: truncatedSSNDchunks no longer triggerIndexOutOfRangeExceptionin the byte-swap loop — the read count is rounded down to a whole block (#1254)
Modernisation (Native AOT, source-generated COM)
NAudio.Core,NAudio.Midi, andNAudio.Wasapiare nowIsAotCompatible=true. AOT compatibility is enforced at build-time byNAudioAotSmokeTest, which fails CI on any new trim or AOT analyzer warning- Most COM interop migrated from
[ComImport]to[GeneratedComInterface]/ComWrappers. Affected interfaces include the WASAPI / Core Audio activation chain (IActivateAudioInterfaceCompletionHandler,IMMNotificationClient,IAudioSessionNotification,IAudioSessionEvents,IAudioEndpointVolumeCallback,IAgileObject,IPropertyStore), the Media Foundation cascade, the DMO interfaces, DirectSound, and theComStreamCCW (now source-generatedIStream) - DirectSound P/Invokes migrated to
[LibraryImport]with[UnmanagedCallersOnly]thunks;BufferDescriptionandBufferCapsconverted from class to struct AcmDriverported from legacyNativeMethodstoNativeLibrary- Most
MediaFoundationInteropblittable P/Invokes migrated to[LibraryImport]
Packaging and dependencies
- Each NAudio package now ships its own README in the NuGet payload
- Test project migrated from VSTest to
Microsoft.Testing.Platform NAudioTestssplit intoNAudio.Core.Tests(cross-platform,net10.0) andNAudio.Windows.Tests(Windows-only,net10.0-windows) — eliminates the dual-TFM double-run on Windows CI and lets non-Windows devs run just the cross-platform suiteNAudio.Alsa.TestsandNAudio.SoundFile.Testsnow ignore MTP exit codes 8/9 sodotnet testsucceeds on machines where the suite legitimately runs zero tests (ALSA off-Linux) or self-skips (libsndfile absent)- Migrated to the modern
.slnxsolution format - Renamed
license.txttoLICENSEfor GitHub license detection; refreshed copyright year to 2008–2026 - Added per-package
<Description>metadata to every shipping NAudio NuGet package so each clearly identifies itself as part of the NAudio family
.NET 9.0
- NAudio.Core (>= 3.0.0-preview.8)
- NAudio.Midi (>= 3.0.0-preview.8)
.NET 9.0
- NAudio.Asio (>= 3.0.0-preview.8)
- NAudio.Core (>= 3.0.0-preview.8)
- NAudio.Dmo (>= 3.0.0-preview.8)
- NAudio.Midi (>= 3.0.0-preview.8)
- NAudio.Wasapi (>= 3.0.0-preview.8)
- NAudio.WinForms (>= 3.0.0-preview.8)
- NAudio.WinMM (>= 3.0.0-preview.8)
| Version | Downloads | Last updated |
|---|---|---|
| 3.0.0-preview.14 | 0 | 06/25/2026 |
| 3.0.0-preview.10 | 7 | 06/13/2026 |
| 3.0.0-preview.9 | 9 | 05/30/2026 |
| 3.0.0-preview.8 | 10 | 05/30/2026 |
| 3.0.0-preview.7 | 12 | 05/30/2026 |
| 3.0.0-preview.6 | 9 | 05/30/2026 |
| 3.0.0-preview.5 | 10 | 05/30/2026 |
| 3.0.0-preview.4 | 10 | 05/30/2026 |
| 3.0.0-preview.3 | 8 | 05/30/2026 |
| 3.0.0-preview.2 | 9 | 05/30/2026 |
| 2.3.0 | 13 | 05/30/2026 |
| 2.2.1 | 8 | 05/30/2026 |
| 2.2.0 | 14 | 05/30/2026 |
| 2.1.0 | 8 | 05/30/2026 |
| 2.1.0-beta.1 | 9 | 05/30/2026 |
| 2.0.1 | 12 | 05/30/2026 |
| 2.0.0 | 10 | 05/30/2026 |
| 2.0.0-beta2 | 10 | 05/30/2026 |
| 2.0.0-beta1 | 10 | 05/30/2026 |
| 1.10.0 | 10 | 05/29/2026 |
| 1.9.0 | 8 | 05/30/2026 |
| 1.9.0-preview2 | 11 | 05/30/2026 |
| 1.9.0-preview1 | 9 | 05/30/2026 |
| 1.8.5 | 9 | 05/30/2026 |
| 1.8.4 | 10 | 05/30/2026 |
| 1.8.3 | 10 | 05/30/2026 |
| 1.8.2 | 10 | 05/30/2026 |
| 1.8.1 | 10 | 05/30/2026 |
| 1.8.0 | 9 | 05/30/2026 |
| 1.7.3 | 9 | 05/30/2026 |
| 1.7.2 | 10 | 05/30/2026 |
| 1.7.1 | 9 | 05/30/2026 |
| 1.7.0 | 10 | 05/30/2026 |
| 1.7.0-beta01 | 9 | 05/30/2026 |
| 1.7.0-alpha06 | 11 | 05/29/2026 |
| 1.7.0-alpha05 | 10 | 05/29/2026 |
| 1.7.0-alpha04 | 7 | 05/29/2026 |
| 1.7.0-alpha03 | 10 | 05/29/2026 |
| 1.7.0-alpha02 | 8 | 05/29/2026 |
| 1.7.0-alpha01 | 10 | 05/29/2026 |
| 1.6.0 | 11 | 05/30/2026 |
| 1.5.7-beta | 10 | 05/30/2026 |
| 1.5.6-beta | 8 | 05/30/2026 |
| 1.5.5-beta | 8 | 05/30/2026 |
| 1.5.4-beta | 9 | 05/30/2026 |
| 1.5.3-beta | 7 | 05/30/2026 |
| 1.5.2-beta | 10 | 05/30/2026 |
| 1.5.1-beta | 9 | 05/30/2026 |
| 1.5.0 | 9 | 05/30/2026 |