How can I convert a wave with Encoding: ALaw, SampleRate: 8000, BitsPerSample: 8, Channels: 1, Block Align Channels: 1, Bits per Second: 8000 to wave with pcm encoding and the same parameters of first wave? I'v been use ALawDecoder from http://www.codeproject.com/Articles/14237/Using-the-G711-standard, now I have an array of shorts (not bytes)! how can I convert short array to byte array and play it using NAudio.WaveOut and how can I write it to a wave file?
You decode Alaw into PCM, which is 16 BitsPerSample - that's why you end up with an array of short
s.
You could use Buffer.BlockCopy()
to copy them into a byte[]
:
byte[] result = new byte[shortArray.Length * sizeof(short)];
Buffer.BlockCopy(shortArray, 0, result, 0, result.Length);