You will need to install the NAudio library in your project using the NuGet package manager.
In this article, we'll show you how to record the audio that's coming from your sound card using NAudio with C# in WinForms. NAudio offers a really useful wrapper around this API that allows you to record the audio from your soundcard easily with C#. It allows delivering an unmodified bitstream to a sound device, and provides benefits similar to those provided by ASIO drivers. It is available in Windows Vista, Windows 7, and later versions of Windows.
The Windows Audio Session API (WASAPI) is Microsoft's most modern method for talking with audio devices. Fortunately with the matter of time, an useful API was introduced to Windows Vista. A couple of years ago, it was really tricky to record the audio that was currently being played in your speakers thanks to the sound card of your computer using C#.