This project has moved. For the latest updates, please go here.

Merging wav files in memory

Oct 10, 2013 at 8:58 AM

Today i've tried to merge certain wav file in memory using WaveFileWriter and MemoryStream. But wave header of this stream is incorrect (empty size fileds), so I've wrote a simple patch:
Oct 10, 2013 at 10:36 AM
that's because you're not disposing your WaveFileWriter. Until you call Dispose, the headers will never be updated.
Oct 10, 2013 at 10:45 AM
If I Dispose WaveFileWriter the MemoryStream will be closed and I can't read from it. My case is merge files and play it without temporary file.
Oct 10, 2013 at 10:52 AM
I usually make an "IgnoreDisposeStream" for this very purpose. I think there's an example somewhere in the NAudio demo code. It's a class that inherits from Stream and passes all methods through to the source stream with the exception of Dispose
Oct 10, 2013 at 11:51 AM
Ok, it's work ;)
Thank you for good advice.

I find reference to this class only in Tests and it's hard to google this solution. I think it is usefull to put reference to this class at FAQ.