获取音频缓冲区数据
我正在使用 naudio,我很好奇如何获取音频缓冲区数据。
有没有办法从 WaveFileReader 读取的 Wave 文件中获取音频缓冲区数据?我想最终将其保存到文件中。
我假设这样做是
byte[] buffer = new byte[wave.Length]; wave.Read(缓冲区, 0, (int)wave.Length);
但是,wave.length 是音频数据缓冲区的长度,还是相对于持续时间的长度?如果不是持续时间,我怎样才能得到持续时间?
I am using naudio and I was curious how I could get the audio buffer data.
Is there a way to obtain the audio buffer data from a Wave file read from WaveFileReader? I would like to eventually save it to a file.
I assumed that to do so was
byte[] buffer = new byte[wave.Length];
wave.Read(buffer, 0, (int)wave.Length);
However, is wave.length the length of the audio data buffer, or is it the length in respect to duration? If not duration, how can I get the duration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
wave.Length
是音频数据的字节数。WaveStream
的TotalTime
属性将尝试将其转换为 TimeSpan。wave.Length
is the number of bytes of audio data. TheTotalTime
property of aWaveStream
will attempt to convert this into a TimeSpan.