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

Not Sure How To Use The SimpleCompressorStream

Oct 24, 2012 at 10:51 PM
Edited Oct 24, 2012 at 11:05 PM

I'd like to apply the compressor to a .wav file and save the output.  When I run the code, it says "Not enough disk space" so I'm clearly doing something to cause it to loop forever.


var sourceStream = new WaveFileReader(pathToSourceWav);

var compressedStream = new SimpleCompressorStream(sourceStream);

compressedStream.Enabled = true;

WaveFileWriter.CreateWaveFile(pathToTargetWav, compressedStream);


Any advice on what I'm doing wrong?

The original file is ~20MB, the target was at 5.5GB when my computer ran out of space. :)

Oct 26, 2012 at 6:26 AM

It's because the SimpleCompressorStream never stops returning audio. It is a very old class, and I have plans to obsolete it and replace it with something better.

Your best fix for now is simply not to use the CreateWaveFile method. Instead, write a loop that reads from the SimpleCompressorStream (e.g. 16kb at a time) and writes to a WaveFileWriter. You can check where you are up to in your source file and stop writing when you go beyond the end.