0

I'm trying to play a sound in vb.net by clicking the button but sadly the when i click the button it showing a error saying "The Wave Header is Corrupt". My Music file type is MP3 but when i convert to wav file it works. So my question is, iS "WAV" file is the only playable Audio file type to use in .NET

Here is my code

My.Computer.Audio.Play(My.Resources.Car_Background_Muisc, AudioPlayMode.WaitToComplete)
  • 1
    WAV is the only format for which there is native support built into the .NET Framework. That doesn't mean that you can't play other formats with the help of unmanaged code or third-party components though. For instance, when I searched the web for "play mp3 in .net", the first result was [this question](https://stackoverflow.com/questions/3129361/how-to-play-mp3-files-in-c). The code is C# but the principles are exactly the same in VB. – jmcilhinney Sep 26 '21 at 05:45
  • 1
    WAV is a container format that can store many different kinds of encoded audio streams. MP3 is not one that's supported, encumbered by royalties that Microsoft wasn't willing to pay, you need a PCM format. Those royalties are the basic reason why MP3 vanished so quickly once players became obsolete, the patent owner dropped the royalty requirement but that didn't revive the format. Its done, don't use it anymore. – Hans Passant Sep 26 '21 at 09:57

0 Answers0