I am using NAudio (126.96.36.199) WasapiLoopbackCapture which works fine and I can open the saved Raw PCM in Audacity with the following format:
Calling code targeting .NET 4 x86. The file is a 10 second recording totalling [3,515,904 bytes].
var device = WasapiLoopbackCapture.GetDefaultLoopbackCaptureDevice();
using (var capture = new WasapiLoopbackCapture(device))
capture.ShareMode = AudioClientShareMode.Shared;
capture.DataAvailable += WasapiCapture_DataAvailable;
capture.RecordingStopped += WasapiCapture_RecordingStopped;
// Verified that [capture.WaveFormat] is [44.1KHz, 32 bit 2 ch].
private void WasapiCapture_DataAvailable (object sender, WaveInEventArgs e)
// Write [e.BytesRecorded] number of bytes from [e.Buffer] to a file.
private void WasapiCapture_RecordingStopped (object sender, StoppedEventArgs e)
// Verified that e.Exception was null.
var file = new FileInfo(/* Same file that was just recorded. */);
using (var stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read))
var waveOut = new WaveOut();
var waveFormat = new WaveFormat(44100, 32, 2); // Same format.
var rawSource = new RawSourceWaveStream(stream, waveFormat);
WaveFormat encoding needs to be IEEE float not PCM (which it currently is)