Skip to main content

Microsoft Silverlight

Answered Question How to access audio sample data in Silverlight?RSS Feed

(0)

lm_telrex
lm_telrex

Member

Member

0 points

3 Posts

How to access audio sample data in Silverlight?

I need to build an audio player control that shows a graphical representation of the audio data. Something that will allow users to identify periods of silence. To do this I need to access the audio sample data.

 

Once I know the url of the audio file, is there any way I can obtain the audio sample data via a simple API? Ideally something that would provide me the raw sample data in a buffer of bytes. I want to avoid if possible writing the code that opens an audio file, decodes its format and accesses the sample data. I am open to any suggestions that can simplify this job.  Thanks

 

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP
Answered Question

Re: How to access audio sample data in Silverlight?

You might try taking a look at Pete Brown's Silverlight Synthesizer project. I believe it has the audio feedback when the sounds play.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Min-Hong Tang - MSFT
Min-Hong...

Contributor

Contributor

3584 points

411 Posts

Re: How to access audio sample data in Silverlight?

Hi,

   Are you saying you want to get a snapshot of the video you want to play.  If this is the case , you may try this:

   WriteableBitmap wb = new WriteableBitmap(mp, null);  //mp is my MediaElement
   img.Source = wb; //img is my image control

Best Regards

Min-Hong Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

lm_telrex
lm_telrex

Member

Member

0 points

3 Posts

Answered Question

Re: Re: How to access audio sample data in Silverlight?

 Thanks Bryant, After looking at a few samples (including Pete Brown's Silverlight Synthesizer) and articles the only way I could do it was by actually writing my own decoder and using the MediaStreamSource class. Unfortunately I could not avoid writing decoder code– which was what I hoped initially.  

minel pather
minel pa...

Member

Member

2 points

1 Posts

Re: Re: How to access audio sample data in Silverlight?

I've had the same problem.

I've managed to port an old C# MP3 decoder to Silverlight 3 and have a working MP3 MediaStreamSource that outputs the raw sample data as well.

When it has been cleaned up (lots of old, unrequired code) I will post it at http://slaudiostreams.codeplex.com/

Hopefully this will be before the 30 days publishing limitation is up on CodePlex.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities