This project has moved and is read-only. For the latest updates, please go here.

NAUDIO PlayBack Problem

Mar 20, 2012 at 10:32 AM

Hi,

I am using NAudio to record audio on a computer and broadcast it to another computer using UDP.
Unfortunately, when I try to Play the received data using WaveOut it throws an error saying "Not a WAVE file - no RIFF header".
How can I play the audio data in bytes through WaveOut? I am able to play the sound using DirectSound.
Below is the code I am using.

MemoryStream ms = new MemoryStream(audioData); TrimmedWaveStream = new TrimWaveStream(new WaveFileReader(ms)); waveOutStream.Init(TrimmedWaveStream); waveOutStream.Play();

Thanks in Adavnce...

Libin

Mar 20, 2012 at 10:35 AM

you can't use WaveFileReader, because what is in your MemoryStream is not a WAVE file. Use RawSourceWaveStream instead.

Mar 20, 2012 at 10:50 AM

Thanks Mark, its just worked fine...