2 Replies - 4066 Views - Last Post: 09 July 2011 - 02:52 PM

#1 bagur  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-June 10

play byte array of sound data in wp7 using xna

Posted 03 July 2011 - 10:38 AM

I have sound data in a byte array.I got this by reading a .wav file using BinaryReader. i want to play it in WP7. is there a way of doing that using xna?


basically its the output of merging n .wav files. on a pc i could save the file and read it back as a stream(using 'FileStream'). i could then play the sound using 'System.Media.SoundPlayer' which takes stream as an argument.

can the problem be solved on similar grounds in wp7?

thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: play byte array of sound data in wp7 using xna

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,958
  • Joined: 21-March 08

Re: play byte array of sound data in wp7 using xna

Posted 05 July 2011 - 08:04 AM

You can try using the SoundEffect class that accepts a stream.

You could also look into using the PhoneyTools SoundEffectPlayer class.

Quote

This class is used to play SoundEffect objects using the XNA integration. The player must live long enough for the sound effect to play so it is common to have it scoped outside a method. For example:

Was This Post Helpful? 0
  • +
  • -

#3 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: play byte array of sound data in wp7 using xna

Posted 09 July 2011 - 02:52 PM

SoundEffect should indeed be the foundation in your case. You can easily create the stream from a byte array by invoking .Write for the stream-based instance that you have. If you look at existing Microphone usage samples, you can see how easy it is possible to replay recorded content.

This post has been edited by Core: 09 July 2011 - 02:55 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1