1

I have the following issue. I want to play a WAV audio file in my C# program, which I converted from MP3 to WAV before. I can't just play it as a MP3 as C# needs the Media Player library added first, but I don't want to use any other library that increases file size or adds another library dll to my export.

So when I use Audacity to convert the file from MP3 to WAV, playing the file in C# works fine, but the WAV file just gets very big, which I want to avoid (from 3 MB MP3 to 25 MB WAV).

Accordingly, I switched to Adobe Premiere Pro because this offers more options to adjust the end size of the file.

Now there are 5 different audio codecs in Adobe Premiere Pro:

  • Uncompressed
  • IMA ADPCM
  • Microsoft ADPCM
  • CCITT A-Law
  • GSM 6.10

With the uncompressed mode, the WAV can be played in C# without any problems. The file size is still very large in this case.

All other audio codecs allow me to reduce the file size up to 80% without audible audio loss, but with each of them I get the error message: "System.InvalidOperationException: "The wave header is corrupt." at runtime.

I tried to fix that with previous threads saying I should try reloading the stream or changing the position of the stream to 0 but that didn't work for me, I still got the same error message.

I don't know if there is even a way to fix it as it might be an issue with the compression? I am able to play those WAV files with Media Player tho. Is there any workaround?

Menrion
  • 41
  • 1
  • 1
    Compression on `.wav` is pretty uncommon and your program would need to know _how_ to uncompress the `.wav` file. There isn't any common standard for compression so the failure to read the `.wav` header is to be expected. `.wav`s are a container for PCM, so they can get big pretty quickly. If you want audio file size low, keep your audio files as `.mp3`. There is no benefit to converting to `.wav` here. – fdcpp Jan 03 '22 at 17:34
  • So, basically, you want a C# application that can play a WAV with IMA ADPCM for example, right? – jms2505 Aug 29 '22 at 17:25

0 Answers0