With the NAudio library I m trying to mix some audio using a WaveMixerStream32 so I m using WaveChannel32 to feed it the streams in the proper format. I ve got an exception with the following message:
Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
The minimum example I could make that also throw that error didn t include WaveMixerStream32 at all with took me to the conclusion that the problem was in how I m using WaveChannel32. The code is this:
var audio = new WaveFileReader(OriginalAudioFileName);
var audio32 = new WaveChannel32(new WaveFileReader(OriginalAudioFileName));
WaveFileWriter.CreateWaveFile(PublicAudioFileName + "audio.wav", audio);
WaveFileWriter.CreateWaveFile(PublicAudioFileName + "audio32.wav", audio32);
audio.wav is generated just fine. audio32.wav is 58 bytes and that line thrown the exception.
What is wrong?