C# Source Code WaveFileSound.cs
using System;
using System.Runtime.InteropServices;

// Helper class to play WAV files
public class WAVSound
{
    // Attach DllImport attribute to the PlaySound method
    [DllImport("WinMM.dll")]
   
public static extern bool PlaySound(byte[]bFileName, int
iSoundFlags);

    // Flag values for SoundFlags argument on PlaySound
    public int SND_ASYNC = 0x0001; // play asynchronously

    // Play the sound file
   
public void Play(string sFileName, int iSoundFlags)
   
{
       
byte[] bFileName = new Byte[256]; // max path length
   
    bFileName = System.Text.Encoding.ASCII.GetBytes(sFileName);
        PlaySound(bFileName, iSoundFlags);
   
}
}