0

i have try to use Naudio library and write this code in c# to change sample rate in wave file but nothing happened
so any one have an idea why this not working or there another way to do this in C# or Java

 using (var reader = new WaveFileReader("C:/Users/FADI/Desktop/1.wav"))
       {

            var newFormat = new WaveFormat(10000, 8, 2);

 using (var conversionStream = new WaveFormatConversionStream(newFormat, reader))
        {
            WaveFileWriter.CreateWaveFile("C:/Users/FADI/Desktop/2.wav", conversionStream);
        }
       }
Fadi
  • 2,320
  • 8
  • 38
  • 77

1 Answers1

0

to change sample rate with the ACM codec (which is what WaveFormatConversionStream uses), you must not change anything else at the same time. Your new format has a bit depth of 8 which looks suspicious. Also you have specified two channels - so the input file must be stereo for this to work.

Mark Heath
  • 48,273
  • 29
  • 137
  • 194