NAudio WaveStream and multiple channels

拟墨画扇 提交于 2019-12-07 04:25:03

问题


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.


回答1:


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).



来源:https://stackoverflow.com/questions/11408185/naudio-wavestream-and-multiple-channels

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!