Back to Naudio

NAudio

src/NAudio/README.md

3.0.13.3 KB
Original Source

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 the NAudio.Effects framework
  • 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.WinMMWaveOut / WaveIn, classic MIDI I/O, ACM codecs and mixer controls via winmm.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:

PackagePlatformWhat it gives you
NAudio.Samplercross-platformPolyphonic software sampler — SoundFont (.sf2), SFZ and single-sample instruments
NAudio.SoundFilecross-platformRead and write WAV/AIFF/FLAC/Ogg-Vorbis/Opus/MP3 via libsndfile
NAudio.AlsaLinuxAlsaOut / AlsaIn playback and capture via libasound
NAudio.Vst3WindowsVST 3 plug-in hosting (preview) — effects and instruments
NAudio.Extrascross-platform (+ Windows extras)Opinionated helpers — playback engine, capture mixing, ID3 tags

Getting started

csharp
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);
}

License

MIT. See the project site for source, issues, and contribution guidelines.