This project has moved. For the latest updates, please go here.

Format of pcm raw array

Aug 25, 2014 at 4:18 PM
Hi,

I want to play a raw array of byte in PCM format (8000 Hz, 1 channel, 16 bit)

I'm doing the following: (decode is the array of byte in pcm format)
Stream RawPcmStream = new MemoryStream(decode);
WaveFormat decodeformat = new WaveFormat(8000, 16, 1);
RawSourceWaveStream rawstream = new RawSourceWaveStream(RawPcmStream, decodeformat);
WaveStream pcm = WaveFormatConversionStream.CreatePcmStream(rawstream);

DirectSoundOut output = new NAudio.Wave.DirectSoundOut();
output.Init(pcm);
output.Play();
Doing this i can only heard noise.

Could be that the format of the array of byte decode (pcm) are bad?
the format need to be in little or big endian?
In 2's complement or normal?

thank for your help