C# 播放声音

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.Load();
player.Play();
异步播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.LoadAsync();
player.PlaySync();
循环播放:

 
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"d:\music\happy.wav";
player.Load();
player.PlayLooping();

注意,只支持wav格式的波形

原文地址:https://www.cnblogs.com/dreamflycc/p/2847959.html