views:

271

answers:

2

For a school project I need to create a program and it'd be nice if it could include some sound effects. We're using C# (and Visual C# Express Edition 2008 Edition) to code our programs, and I was wondering if there's anyway to play short audio files without installing the DirectX SDK.

On our school computers, we don't have sufficient access to install any SDKs, and we have to use those computers for development. Is there any way to play audio files w/o the DirectX SDK?

+5  A: 

You can use a System.Media.SoundPlayer, but it will only work with wavs.

MiffTheFox
Thanks, that was very helpful!
Chris Thomson
+3  A: 

You can add sound effects with the speech engine (.net3), too!
Fun Fun Fun!

Add a reference to System.Speech dll

using System.Speech;

System.Speech.Synthesis.SpeechSynthesizer ss = new System.Speech.Synthesis.SpeechSynthesizer();  
ss.Rate = 8;  
ss.SpeakAsync("Booom Booom Booom Booom Booom Booom");

Try increase/decrease the Rate and pitch for more fun

Peter Gfader