?
Solved

PCM realtime audio playback from a Stream

Posted on 2006-11-14
2
Medium Priority
?
1,594 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

718 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