Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PCM realtime audio playback from a Stream

Posted on 2006-11-14
2
Medium Priority
?
1,622 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 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

963 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