Solved

PCM realtime audio playback from a Stream

Posted on 2006-11-14
2
1,431 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now