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

problem with WaveFileWriter

Oct 19, 2010 at 10:31 AM


Have some code like that


WaveStream mp3Reader = new Mp3FileReader(source);
byte[] AllTrack = new byte[mp3Reader.Length];
mp3Reader.Read(AllTrack, 0, (int)mp3Reader.Length);
WaveFileWriter LoopedWave = new WaveFileWriter(File.Create("c:\\1.wav"), mp3Reader.WaveFormat);
LoopedWave.WriteData(AllTrack, 0, AllTrack.Length);

and in LoopedWave.Close() catch divide by zero in

protected virtual void Dispose(bool disposing)

in string

w.Write((int)((dataChunkSize * 8) / format.BitsPerSample));

(format.BitsPerSample == 0;)

I doing something wrong or what?



Nov 4, 2010 at 8:10 PM

looks like you are trying to put MP3 into a WAV file. While it is possible, it is not exactly a normal thing to do. If you need to convert to WAV, then look at the WaveFormatConversionStream