32bits to 16bits NAudio system sounds recording

  • Thread starter Thread starter josh_bauer2020
  • Start date Start date
J

josh_bauer2020

Guest
I recorded sound from speakers as 32 bits with NAudio
but wished to have it as 16 bits. What is best way to do so?
Code sample is below:

WasapiLoopbackCapture CaptureInstance = new WasapiLoopbackCapture();
WaveFileWriter RecordedAudioWriter = new WaveFileWriter(outputFilePath, CaptureInstance.WaveFormat);

CaptureInstance.DataAvailable += (s, a) =>
{
RecordedAudioWriter.Write(a.Buffer, 0, a.BytesRecorded);
};

CaptureInstance.RecordingStopped += (s, a) =>
{
RecordedAudioWriter.Dispose();
RecordedAudioWriter = null;
CaptureInstance.Dispose();
};

CaptureInstance.StartRecording();

Continue reading...
 
Back
Top