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

WaveChannel32.Read never returns 0

Nov 29, 2012 at 9:12 AM
Edited Nov 29, 2012 at 9:26 AM

I was trying to convert 16bit PCM files to IeeeFloat and encountered a problem where the files grew until hitting the 2GB limit.My code was:


public static void ImportAudio3(string sourceFileName, string targetFileName) {
	using (var reader = new WaveFileReader(sourceFileName)) {
		using (var channel = new WaveChannel32(reader)) {
			WaveFileWriter.CreateWaveFile(targetFileName, channel);

Is it intended that WaveChannel32.Read() never returns 0 or is it a bug?

I just realized that I can avoid using WaveChannel32 by using AudioFileReader and passing that directly to WaveFileWriter.CreateWaveFile, but I still thought I'd ask because I'm using WaveChannel32 in other places.


Edit: After reading WaveChannel32's description ("represents channel for the WaveMixerStream") I guess its current behaviour is intended. If so, never mind my question. BTW, many thanks for all the time and effort you've put into this wonderful library!

Nov 29, 2012 at 9:37 AM

set PadWithZeros to false or preferably use Wave16ToFloatProvider instead. Really I want to obsolete WaveChannel32 and WaveMixerStream, as there are better ways to do mixing but a lot of people are still using them.