I am trying to read bytes from a wav file and send it across to a stream but it plays slowly.
Could you please help me to know the right way of populating the byte[]?
Thanks for you help.
are you using NAudio to both read the WAV file and play the data?
you need to make sure you use the same WaveFormat at both ends
Related
I am currently developing a c# Windows Form. My intention is to create a form that can make calls to other PCs in the same network.
So far I have found solutions that record the audio from my microphone and then convert it to bytes and send it using Tcp sockets. The thing is, is there a way to directly convert the audio to bytes and send it through a socket without recording the audio in a file and then send it.
Thanks in advance.
would converting the record to a memorystream be what your looking for?
if so you want this How to record audio using naudio onto byte[] rather than file
You can then write the stream to a tcpsocket. (you could write the thing direct to networkstream but i would consider it bad practice)
It would be wise to write samplerate*3 just in case of lantcy issues.
I have an app which is receiving wave data (PCM raw data) via network through UDP port.
How can I set up to play received wave data using Naudio.
I have tried to find with google and read some stuff related to Naudio documentation, but so far haven't any success.
Any help or hint would be appreciated. Thanks in advance.
The NAudioDemo application demonstrates how to do this in the Network Chat demo. You use the BufferedWaveProvider to store the decompressed audio as it arrives, and use that to feed WaveOut. you might also want to automatically pause if there is not enough buffered audio, to prevent stuttering playback.
Well I did some work on this nAudio stuff long back and am sorry I might not be of much help as I am afraid I hardly remember it...
But I think there was something like WaveOut Class and a WaveStream which contained your WAV data and you call Play on the WaveOut class after associating it with WaveStream.
Try give a look to this WavOut class you might get some clues, also I was quite new to this Audio world when I worked on that and my approach was to take their sample program that plays a wav file and see how they are doing it...that was how I figured out what needs to be done....
Good Luck...
Simple.
UDP Stream --> buffer --> NAudio WaveStream
First, check that the source PCM audio can be played correctly by NAudio. Do this "offline", before sending it via a socket.
I will do some research and post some code later.
Can someone give an example of how to record, play, save and also encode a .wav file in a pcm file (u-law encode for ex). I would like to create a rtp stream. THX
NAudio can be used to record audio, convert it to u-law and save it to a WAV file. The included NAudioDemo application demonstrates how to perform all three tasks.
For creating an RTP stream, you could try RTP.NET
Is there any way to play MP3 directly from a memory stream (without any temp. files) using VB.NET or C#? or play from SQLCe database?
Thanks
I'll suggest you try Mp3Sharp. It is a port of JavaLayer and it is written in C#. I am currently using it and SlimDX to play ShoutCast Mp3 streams. So far it works very well. There is an Mp3Stream class which you use to read the stream and return a predetermined number of PCM bytes. You can write those bytes to a DirectSound buffer for playback if you wish.
IrrKlang can also do this for you.
I need to programatically convert mp3's of any bitrate to a standard bitrate for streaming audio using c#.
Currently a buffer is populated with mp3 data from disk and then send out to the "listeners" at what should be a constant speed (the broadcast), but the mp3's could be of any bitrate. This makes timing extremely difficult and should rather be streamed at a standard bitrate instead of a bitrate dictated by the mp3 itself.
Lame seems to be the right encoder for the job, but any documentation or sample code only seems to be concerned with converting from wav samples to mp3. Not mp3 to mp3. The exe wrapper can do the bitrate conversion, but completely without any clue as to what gets passed to beEncodeChunk().
Has anyone had any experience in doing this kind of thing with lame or any similar encoder?
Do i need to decode to wav then encode back to mp3 to achieve what i'm after?
I welcome any links or advice with open arms.
Thanks
you have to decode the mp3 to wav, then re-encode it to the new bitrate