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

1kb wav file

Nov 19, 2014 at 7:45 AM
I'm trying to make a 8khz a 44 khz wav file but when I generate a 44khz file it is empty (1kb in size from 300 kb) my code follows any help is greatly appreciated
 using (WaveFileReader wfr = new WaveFileReader(fn))
                {
                    var newFormat = new WaveFormat(44, wfr.WaveFormat.BitsPerSample, wfr.WaveFormat.Channels);
                    using (WaveFileWriter wfw = new WaveFileWriter("C:\\Users\\karls_000\\OneDrive\\Documents\\temp16khz.wav", newFormat))
                    {
                        using (WaveFormatConversionStream conversionStream = new WaveFormatConversionStream(newFormat, wfr))
                        {
                            conversionStream.Position = 0;
                            byte[] buffer = new byte[1024];
                            while (conversionStream.Position < conversionStream.Length)
                            {
                                int bytesRead = conversionStream.Read(buffer, 0, 1024);
                                if (bytesRead > 0)
                                {
                                    wfw.Write(buffer, 0, bytesRead);
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
Marked as answer by zoomvirus on 11/19/2014 at 12:54 AM
Nov 19, 2014 at 7:54 AM
Omg I never notice I missed 000 off the 44000 I can't find how to delete this sorry for this pointless question.
Coordinator
Nov 19, 2014 at 8:15 AM
great, glad you found what the problem was ;)