Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

NAudio

> 编程语言
Open source

Audio and MIDI library for .NET

6.2K stars0 likes3 views
WebsiteGitHub

About

Audio and MIDI library for .NET

NAudio

NAudio is an open source .NET audio library written by Mark Heath

Documentation site — tutorials and the full API reference.

NAudio 3

NAudio 3 is a major release. The headlines:

  • The single 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.
  • The core is cross-platform and Native-AOT compatible. NAudio.Core, NAudio.Midi, NAudio.Effects, NAudio.Sampler and NAudio.SoundFile run on Windows, Linux and macOS.
  • Minimum target framework is net9.0 — legacy .NET Framework and .NET Standard 2.0 support is dropped.
  • New subsystems: an audio effects framework, a software sampler, VST 3 hosting, ALSA playback/capture on Linux, and cross-platform file I/O via libsndfile.
  • Modernised WASAPI and ASIO — the new 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.

Packages

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.

Package Platform What it gives you
NAudio any Meta-package — the Windows stack plus 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.

Documentation

  • Documentation site — tutorials and the full API reference.
  • Tutorials — the task-focused how-to guides listed below, also in Docs/.
  • Migrating from NAudio 2 — every breaking change, with before/after code.
  • NAudio articles on Mark Heath's blog.

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.

Features

  • Play back audio using a variety of APIs
    • WASAPI (WasapiPlayer, and the legacy WasapiOut)
    • WaveOut
    • ASIO
    • DirectSound
    • ALSA on Linux
  • Read audio from many standard file formats
    • WAV, AIFF and raw PCM
    • MP3 (using ACM, DMO or MFT)
    • G.711 mu-law and a-law
    • ADPCM, G.722, Opus (using Concentus)
    • WMA, AAC, MP4 and more with Media Foundation
    • FLAC, Ogg Vorbis, Opus and MP3 cross-platform with libsndfile
  • Convert between various forms of uncompressed audio
    • Change the number of channels — mono to stereo, stereo to mono, and arbitrary matrix routings
    • Modify bit depth (8, 16, 24, 32 integer or 32 bit IEEE float)
    • Resample audio using a choice of resampling algorithms
  • Encode audio using any ACM or Media Foundation codec installed on your computer
    • Create MP3s, AAC/MP4 audio and WMA files
    • Create WAV files containing G.711, ADPCM, G.722, etc.
    • Encode FLAC, Ogg Vorbis and Opus on any platform with NAudio.SoundFile
  • Mix and manipulate audio streams using a 32-bit floating point mixing engine
    • construct signal chains
    • examine sample levels for the purposes of metering or waveform rendering
    • pass blocks of samples through an FFT for metering or DSP
    • delay, loop, or fade audio in and out
  • Apply audio effects with the cross-platform NAudio.Effects framework
    • EQ and filtering, dynamics (compressor, limiter, gate, multiband), saturation and lo-fi
    • delay and modulation, reverb including FFT convolution, pitch shifting
    • click-free bypass, dry/wet mix and a parameter model for automation
  • Record audio using a variety of capture APIs
    • WASAPI (WasapiRecorder), including system audio and per-process loopback
    • WaveIn
    • ASIO
    • ALSA on Linux
  • Host VST 3 effects and instruments
  • Play SoundFont (.sf2) and SFZ instruments with the built-in software sampler
  • Work with soundcards
    • Enumerate devices
    • Access soundcard controls and metering information
    • Follow the default device automatically, and observe endpoint changes as events
  • Full MIDI event model
    • Read and write MIDI files
    • Respond to received MIDI events
    • Send MIDI events
    • Render a MIDI file to audio through the sampler or a hosted VST 3 instrument
  • An extensible programming model
    • All base classes easily inherited from for you to add your custom components

Tutorials

Upgrading

  • Migrating from NAudio 2 to NAudio 3
  • Migrating from AsioOut to AsioDevice

Playback

  • Playing an Audio File from a WinForms application
  • Playing an Audio File from a Console application
  • Playing Audio from a URL
  • Choose an audio output device type
  • Enumerate and select Output Devices
  • Playing audio with WasapiPlayer (recommended for WASAPI)
  • Creating and configuring a WasapiOut device (legacy)
  • Implement "Fire and Forget" Playback (e.g. game sound effects)
  • Play streaming MP3
  • Handling playback stopped
  • Understanding WaveStream, IWavePlayer and ISampleProvider
  • Playing Audio with ASIO

Working with Codecs

  • Convert an MP3 to WAV
  • Encode to MP3 and other formats using MediaFoundationEncoder
    • More examples
  • Understand how to convert between any audio formats you have codecs for
  • Enumerate Media Foundation Transforms (MFTs)
  • Enumerate ACM Codecs
  • Fix the NoDriver calling acmFormatSuggest issue

Working with audio files

  • Mix Two Audio Files to WAV
  • Cross-platform audio files with NAudio.SoundFile
  • Trim a WAV File
  • Merge MP3 Files
  • Convert an AIFF file to WAV
  • Use the WavFileWriter class

Manipulating audio

  • Convert between mono and stereo
  • Concatenating Audio
  • Skip and Take Using OffsetSampleProvider
  • Implement Looped Playback
  • Work with Multi-Channel Audio
  • Resample Audio
  • Input driven Audio Resampling
  • Using RawSourceWaveStream
  • Adjust the pitch of audio using SmbPitchShiftingSampleProvider
  • Varispeed playback with NAudio using SoundTouch
  • Fade audio in and out
  • Apply audio effects with NAudio.Effects

Generating audio

  • Play Sine Waves and other signal types
  • Implement sine wave with portamento
  • Play SoundFont, SFZ and single-sample instruments

Recording

  • Recording a WAV file from a WinForms application
  • Recording audio with WasapiRecorder (recommended for WASAPI)
  • Capturing system audio with WasapiLoopbackCapture (legacy)
  • Mix the microphone and system audio
  • Play and Record audio at the same time
  • Record Audio with ASIO
  • Duplex Processing with ASIO
  • ASIO Channel Mapping
  • Handling ASIO Driver Resets

Visualization

  • WaveForm Rendering to PNG
  • Implement a Recording Level Meter

MIDI

  • Sending and Receiving MIDI Events
  • Exploring MIDI Files with MidiFile
  • MIDI Event types

Networking

  • Stream live audio over the network (Network Chat)

Cross-platform and Linux

  • Cross-platform audio files with NAudio.SoundFile
  • [Playing an

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言