Prepend WAV Header in NAudio

为君一笑 提交于 2019-12-02 08:40:25

You can use WaveFileWriter to write to a Stream. So in this case, I'd write to a MemoryStream, and the WaveFileWriter must be disposed in order to properly finalize the WAV headers. But then you'll have an in-memory representation of a WAV file.

One caveat, is that you might end up disposing the MemoryStream when you dispose the WaveFileWriter, so I have a convenience class in NAudio called IgnoreDisposeStream which you can wrap the MemoryStream in to stop it getting disposed before you use it.

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