NAudio WaveStream and Multiple Channels

I have a WaveStream and I can read WaveFormat to get the number of channels. When I read from this WaveStream, do I read the first channel or data from all channels mixed?

I want the user control to display WaveForm, but I'm not sure if its control is displayed correctly.

+4
source share
1 answer

When you read WaveStream, you read all the sample channels, one by one. First you read the first channel, and the second sample is the first sample of the second channel.

If you put them in an array, then the first index will be the first channel, the second - the second, the third - the third. Therefore, if you show the left channel in waveform, you must display indices 0, 2, 4, and 6, and if you show zero indices of 1, 3, 5, and 7 channels (if you have a stereo wave file of course).

+4
source

All Articles