I am very new to NAudio, and I need to convert the input sample buffer from the input device to a doubling array that ranges from -1 to 1.
I create an input device as follows:
WaveIn inputDevice = new WaveIn();
//change the input device to the one i want to receive audio from
inputDevice.DeviceNumber = 1;
//change the wave format to what i want it to be.
inputDevice.WaveFormat = new WaveFormat(24000, 16, 2);
//set up the event handlers
inputDevice.DataAvailable +=
new EventHandler<WaveInEventArgs>(inputDevice_DataAvailable);
inputDevice.RecordingStopped +=
new EventHandler(inputDevice_RecordingStopped);
//start the device recording
inputDevice.StartRecording();
Now when the callback 'inputDevice_DataAvailable' is called, I get an audio data buffer. I need to convert this data into an array of two pairs that represent volume levels between -1 and 1. If someone can help me, it will be great.
source
share