If you don't mind including Microsoft.VisualBasic.dll in your project, you can do it like this:
var audio = new Microsoft.VisualBasic.Devices.Audio(); audio.Play("some file path");
If you want to do more complex things, the easiest way I know is to use the Windows Media Player API . You add a DLL and then work with it. The API is pretty awkward, but it works; I used it to make my own music player cover for Windows Media Player for personal use. Here are some useful links to get you started:
Build a website using ASP.NET 2.0 to navigate your music library
Windows Media Object Model
Let the music play!
EDIT:
Since I wrote this, I found an easier way if you don't mind including the WPF classes in your code. WPF (.NET 3.0 and forward) has a MediaPlayer class that wraps Windows Media Player. This means that you donβt need to write your own shell, which is good, because, as I mentioned above, the WMP API is quite awkward and difficult to use.
Ryan lundy
source share