Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: Mixing multiple WaveStreams

$
0
0

Are you able to write out to WAV file at any stage in your pipeline? I should probably add a utility waveprovider to NAudio that does this but it's not too hard. Create a class that implements IWaveProvider. In the constructor take a source stream and open a WaveFileWriter. In the Read method, read from the source, but before returning bytes read, also write to the writer. Then make sure you Dispose the when you are done to make a valid WAV file.

You can then insert this waveprovider at different points in your pipeline to see at what stage the audio is getting corrupted.

 

public int Read(byte[] buffer, int offset, int count)

{

   int bytesRead = this.source.Read(buffer, offset, count)'

   this.writer.Write(buffer, offset, bytesRead);

   return bytesRead;

}


Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>