This project has moved and is read-only. For the latest updates, please go here.

Merging wav files in memory

Oct 10, 2013 at 9: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 11: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 11: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 11: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 12:51 PM
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.