5

I have a WaveStream, and I can read WaveFormat to obtain number of channels. When I read from that WaveStream am I reading the first channel or data from all the channels mixed?

I want to do a user control to display WaveForm, but I'm not sure if my control displays it properly.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
apocalypse
  • 5,764
  • 9
  • 47
  • 95

1 Answers1

5

When you are reading from WaveStream, you are reading all channel samples, one by one. First you are reading 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 is the first channel, the second index is the second channel, the third index is the third channel. So if you are displaying the left channel in your waveform, you should display indexes 0, 2, 4, and 6 and if you are displaying the right channel indexes 1, 3, 5, and 7 (if you have a stereo wave file of course).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Legoless
  • 10,942
  • 7
  • 48
  • 68
  • 1
    *So if you are displaying left channel in your waveform, you should display indexes 0,2,4,6 [..]* Can you explain a bit more on how to read a sample from WaveStream and display it in WaveViewer (GUI control)? I can play a wav file but would like to display waveforms for both of the channels. – c0dehunter Mar 04 '13 at 20:56