适用于 .NET 的音频和 MIDI 库
NAudio is an open source .NET audio library written by Mark Heath
Documentation site — tutorials and the full API reference.
NAudio 3 is a major release. The headlines:
NAudio assembly is split into focused packages — take only what you need. The NAudio meta-package still pulls the Windows stack together, so existing consumers see no change.NAudio.Core, NAudio.Midi, NAudio.Effects, NAudio.Sampler and NAudio.SoundFile run on Windows, Linux and macOS.net9.0 — legacy .NET Framework and .NET Standard 2.0 support is dropped.WasapiPlayer / WasapiRecorder and AsioDevice APIs.Upgrading from NAudio 2? Start with Migrating from NAudio 2 to NAudio 3. The full list of changes is in RELEASE_NOTES.md.
Installing the NAudio meta-package gets you the full Windows stack and is the right default. On a non-Windows target framework it resolves to the cross-platform pieces only. Reference the individual packages directly if you want a smaller surface.
AudioFileReader and Mp3FileReader
NAudio.Core
cross-platform
WaveStream / ISampleProvider model, WAV & AIFF I/O, mixing, resampling, DSP, NAudio.Effects, sequencing
NAudio.Midi
cross-platform (+ WinRT MIDI on Windows)
MIDI event model, Standard MIDI File reading & writing
NAudio.Wasapi
Windows
WASAPI playback, capture and loopback; Media Foundation codecs
NAudio.WinMM
Windows
WaveOut / WaveIn, classic MIDI I/O, ACM codecs, mixer controls
NAudio.Asio
Windows
Low-latency multichannel playback and capture through ASIO drivers
NAudio.Dmo
Windows
DMO effects, DMO MP3 decoder and resampler, DirectSoundOut
NAudio.WinForms
Windows
WinForms 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 (+ Windows extras)
Opinionated helpers — playback engine, capture mixing, ID3 tags
NAudio.Core, NAudio.Midi, NAudio.Wasapi, NAudio.Dmo, NAudio.Sampler, NAudio.SoundFile and NAudio.Alsa are Native-AOT compatible. See the assembly layout plan for the reasoning behind the split.
NAudio comes with several demo applications, which are the quickest way to see how the various features fit together: NAudioDemo (WinForms), NAudioWpfDemo, and the smaller NAudioConsoleTest, AudioFileInspector, MidiFileConverter and MixDiff tools. They have the advantage of being kept up to date, whilst some of the tutorials you will find on the internet refer to old versions of NAudio.
WasapiPlayer, and the legacy WasapiOut)NAudio.SoundFileNAudio.Effects frameworkWasapiRecorder), including system audio and per-process loopback.sf2) and SFZ instruments with the built-in software sampler暂无开放 Issues,或尚未同步最近议题。