简体   繁体   English

如何在 WinForms 中播放声音?

[英]How can I play a sound in WinForms?

如何使用 C# 在 WinForms 中播放声音?

For playing sound simply, with no interaction you can use System.Media.SoundPlayer:为了简单地播放声音,无需交互,您可以使用 System.Media.SoundPlayer:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "soundFile.wav";
player.Play();

NAudio is a great library to reproduce sound, you can find it here: http://naudio.codeplex.com/ NAudio 是一个很好的再现声音的库,你可以在这里找到它: http : //naudio.codeplex.com/

And the tutorial is here: http://opensebj.blogspot.com/2009/02/introduction-to-using-naudio.html教程在这里: http : //opensebj.blogspot.com/2009/02/introduction-to-using-naudio.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM