-3

I have a question regarding with audio files.My question is:How can I play any audio file(e.g. mp3,wav) in C#? 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.

MaxCoder88
  • 2,374
  • 6
  • 41
  • 59

3 Answers3

1
  1. for that first you need to load wmp.dll from your system32 folder
  2. Then you need to add COM component
  3. Now you can do other things(creating player)
deepi
  • 1,081
  • 10
  • 18
0

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.

Alan Turing
  • 2,482
  • 17
  • 20
0

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.

alistair
  • 1,054
  • 9
  • 10
  • To play MP3 in C# you steel need to decode programmatically (using FFT or other algorighm, used by mp3, ogg format) or using you video/accelerator card (please, do not laugh ;|, ATI and NVIDIA SDKs already is up to date) – Alan Turing Sep 14 '11 at 07:08