Play Audio Files (Wav) With C#

The sample below is a snippet that shows how to play audio files with C#.

using System.Media;
// the following function can be appropriately inserted in a class
void PlayAudio (string path)
SoundPlayer Mplayer=new SoundPlayer ();

The example further extends by having an event handler for a Form's Load event. So, the audio file is played when the form is loaded.

//play Audio file(Wav)on form load

Private Void Form_Load(object sender,EventArgs e)


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: