How can I play any audio file(e.g. mp3,wav) in C#?
I have a question regarding with audio files.My question is:How can I play any audio file(e.g. mp3,wav) in C开发者_Go百科#? So if I press a button,I want to play to an audio file. How can I do that? Can you tell me how it is done with a sample code?Lastly,I have used .Net Framework 4.0.
- for that first you need to load wmp.dll from your system32 folder
- Then you need to add COM component
- Now you can do other things(creating player)
I have a tiny project (cutted NAudio version, only playback is left and only MP3 and WAV is supported) to play MP3 and WAV files. Do you still need it? I can upload it if you need to.
A full code example on how to play waves in c# forms apps can be found here
http://msdn.microsoft.com/en-us/library/ms173187%28v=VS.100%29.aspx
You can also play wave files using C# and the XNA Framework. But that may not serve your purpose, since that is primarily for games development.
精彩评论