public static bool TryPlay(Stream audio, IntPtr hwnd) { try { Mp3Stream mp3Stream = new Mp3Sharp.Mp3Stream(audio); mp3Stream.Position = 0; if (mp3Stream.DecodeFrames(1) == 0) { throw new Exception("Could not decode"); } Device dev = new Microsoft.DirectX.DirectSound.Device(); dev.SetCooperativeLevel(hwnd, Microsoft.DirectX.DirectSound.CooperativeLevel.Normal); StreamedMp3Sound ApplicationStreamedSound = new StreamedMp3Sound(dev, mp3Stream); ApplicationStreamedSound.Play(); ApplicationStreamedSound.Stop(); return(true); } catch (Exception ex) { return(false); } }