Arslan Pervaiz
Arslan Pervaiz

Reputation: 1633

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.

Upvotes: 1

Views: 993

Answers (2)

fxbayuanggara
fxbayuanggara

Reputation: 337

You can use any of .wav files with these format criteria :

Codec: Microsoft PCM Format

Sample Rate: 11025

Channels: 1 (mono) or 2 (stereo)

Bit Depth: 16 Bit

Upvotes: 1

Stuart
Stuart

Reputation: 66882

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/

Upvotes: 1

Related Questions