naudio / NAudio
Audio and MIDI library for .NET
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing naudio/NAudio in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewNAudio NAudio is an open source .NET audio library written by Mark Heath Features • Play back audio using a variety of APIs • WaveOut • DirectSound • ASIO • WASAPI • Read audio from many standard file formats • WAV • AIFF • MP3 (using ACM, DMO or MFT) • G.711 mu-law and a-law • ADPCM, G.722, Speex (using NSpeex) • WMA, AAC, MP4 and more others with Media Foundation • Convert between various forms of uncompressed audio • Change the number of channels - Mono to stereo, stereo to mono • 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 (Windows 8 and above) • Create AAC/MP4 audio (Windows 7 and above) • Create WMA files • Create WAV files containing G.711, ADPCM, G.722, etc. • Mix and manipulate audio streams using a 32-bit floating 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 • Perform EQ with a BiQuad filter (allowing low pass, high pass, peaking EQ, etc.) • Pitch shifting of audio with a phase vocoder • Record audio using a variety of capture APIs • WaveIn • WASAPI • ASIO • Record system audio with WASAPI Capture • Work with soundcards • Enumerate devices • Access soundcard controls and metering information • Full MIDI event model • Read and write MIDI files • Respond to received MIDI events • Send MIDI events • An extensible programming model • All base classes easily inherited from for you to add your custom components • Support for UWP (preliminary) • Create Windows 8 Store apps and Windows Universal apps Getting Started The easiest way to install NAudio into your project is to install the latest NAudio NuGet package. Prerelease versions of NAudio are also often made available on NuGet. NAudio comes with several demo applications which are the quickest way to see how to use the various features of NAudio. You can explore the source code here. Tutorials 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 • Creating and configuring a WasapiOut device • 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 • Trim a WAV File • Merge MP3 Files • Convert an AIFF file to WAV • Use the WavFileWriter class • Create an ID3v2 tag 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 Generating audio • Play Sine Waves and other signal types • Implement sine wave with portamento Recording • Recording a WAV file from a WinForms application • Capturing system audio with WasapiLoopbackCapture • Play and Record audio at the same time • Record Audio with ASIO Visualization • WaveForm Rendering to PNG • Implement a Recording Level Meter MIDI • Sending and Receiving MIDI Events • Exploring MIDI Files with MidiFile • MIDI Event types More... Additional sources of documentation for NAudio are: • Original Documentation on CodePlex • NAudio articles on Mark Heath's blog NAudio Training Courses If you want to get up to speed as quickly as possible with NAudio programming, I recommend you watch these two Pluralsight courses. You will need to be a subscriber to access the content, but there is 10 hours of training material on NAudio, and it also will give you access to their vast training library on other programming topics. • Digital Audio Fundamentals • Audio Programming with NAudio To be successful developing applications that process digital audio, there are some key concepts that you need to understand. To help developers quickly get up to speed with what they need to know before trying to use NAudio, I have created the Digital Audio Fundamentals course, which covers sample rates, bit depths, file formats, codecs, decibels, clipping, aliasing, synthesis, visualisations, effects and much more. In particular, the fourth module on signal chains is vital background information if you are to be effective with NAudio. Audio Programming with NAudio is a follow-on course which contains seven hours of training material covering all the major features of NAudio. It is highly recommended that you take this course if you intend to create an application with NAudio. How do I...? The best way to learn how to use NAudio is to download the source code and look at the two demo applications - NAudioDemo and NAudioWpfDemo. These demonstrate several of the key capabilities of the NAudio framework. They also 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. FAQ **What is NAudio?** NAudio is an open source audio API for .NET written in C# by Mark Heath, with contributions from many other developers. It is intended to provide a comprehensive set of useful utility classes from which you can construct your own audio application. **Why NAudio?** NAudio was created because the Framework Class Li…