This project has moved. For the latest updates, please go here.

WaveInEventArgs buffer, data interpretation

Mar 15, 2011 at 9:08 AM


I'm using NAudio library to capture sound produced by any windows app like mp3 or videp player to get that audio data in order to control my light show contraption based on RGB strips (like I did it already for video). As far I understand following code should be sufficient to capture sound:


            waveInStream = new WaveIn();
            waveInStream.WaveFormat = new WaveFormat(44100, 16, 2);
            waveInStream.DataAvailable += new EventHandler<WaveInEventArgs>(waveInStream_DataAvailable);

Question is how should I interpret that data (bytes) in WaveInEventArgs buffer in order to use them in further processing stages (like FFT, V U meter and similar)? Can I assume that they should follow exact format like in WAV data chunk (like it's defined in WAV PCM specification)?



Mar 16, 2011 at 5:15 PM

have a look at the voice recorder app ( and the articles linked to on Coding4Fun for info.

Basically with the setup you have, every two bytes is a sample (use BitConverter.ToShort) in pairs (left sample, right sample)