Solved

PCM realtime audio playback from a Stream

Posted on 2006-11-14
2
1,450 Views
Last Modified: 2010-05-18

Im receiving pcm audio data from a Stream which i want to playback in "realtime". Im not sure at all how to do this, except that i thought about switching between two buffers.

Are there any classes in .NET Framework 2.0 supporting audio playback using buffers ?

Any help (code examples) would be much appreciated .. as i am stuck with this problem (challenge) ...

 - Dennis
0
Comment
Question by:Chokehold
2 Comments
 
LVL 8

Accepted Solution

by:
redpipe earned 500 total points
ID: 17937237
Try theese tips for starters:

A low-level audio player in C#
http://www.codeproject.com/cs/media/cswavplay.asp

A full-duplex audio player in C# using the waveIn/waveOut APIs
http://www.codeproject.com/cs/media/cswavrec.asp

SoundPlayer Class (Controls playback of a sound from a .wav file)
http://msdn2.microsoft.com/en-us/library/system.media.soundplayer.aspx
0
 
LVL 2

Author Comment

by:Chokehold
ID: 17941096
thanks so far :)

I tried to use the SoundPlayer class for playback but encountered another problem here, which leaves me with a questions:

1. Is it possible to have a constant stream of audio which is played as it comes in, using the SoundPlayer class?. In my case i have one computer constantly sending audio PCM audio to another computer which needs to start playback of the audio the moment the first audio data arrives....

If not SoundPlayer is not the solution, so what is ? :)

I tried playing audio data received via bluetooth from another device sending a PCM Wave file binary using Yath Hyper-terminal. When received in my application im storing the audio data in a circular buffer. I made my own AudioStream class which implements Stream and overrides the methods. So when using the .Read(......) method im working on my audio data buffer instead.
The SoundPlayer instances is given the AudioStream instance (casted to Stream) but after calling .play() i get the error message "Corrupt audio header ...... something"

I would have postet some of my source code here, but since im not at work right now i dont have access to it. Will do tomorrow in hope of a solution.

Many Thanks in advance

-Dennis
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Page navigation in windows phone 8.1 application not working. 5 24
PrintingFoundIt(Almost!(Damn!)) 1 27
Problem!!! 8 33
transaction in asp.net, sql server 6 33
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question