Search code examples
c#windows-phone-7xna

Unable to play wav file in WP7


while playing this wav file in windows phone 7 its getting error.

var stream = TitleContainer.OpenStream("TestSound.WAV");
            var effect = SoundEffect.FromStream(stream);
            FrameworkDispatcher.Update();
            effect.Play();

And Its getting this exception on second line of code.

Ensure that the specified stream contains valid PCM mono or stereo wave data.

Solution

  • I've played wav files lots...

    What wav file are you trying to play?

    Here's a very simple sound I've played before... http://iron7.com/forapp/xylo/x1.wav

    I find the audacity tool is particularly useful for editing files into an acceptable format - http://audacity.sourceforge.net/