NAudio WaveIn.DataAvailable Event: Separating Channels

Assume a Stereo WaveIn whose samples are being intercepted through the WaveIn.DataAvailable (ByVal sender As Object, ByVal e As WaveInEventArgs) event. How could the samples of a specific channel (i.e. Right/Left) be extracted from e.Buffer?


Solution 1:

Samples are stored interleaved. So if you are recording 16 bit samples, the first two bytes are a left channel sample, the second two bytes are a right channel sample, then another left sample, and so on.