Solved

PCM realtime audio playback from a Stream

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

18 Experts available now in Live!

Get 1:1 Help Now