Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this type of file: 8000Hz, 8 bits per sample, 64 Kbps, stereo, A-law wav file. I need to decode the alaw compression to 16 bit pcm linear encoding.

I used a lookup table for this from this site which gives signed decimal numbers from -32768 to 32767 which corespond to 16 bit signed binary number.

So I can convert signed decimal to signed 16 binary number but how to get left and right channel bytes. As a signed bytes or unsigned bytes?

Or should I convert the signed 16 bit number to unsigned and then get the left and right bytes as unsigned?

share|improve this question

migrated from Jan 24 '14 at 12:01

This question came from our site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

Do you want an audio program that will convert your WAV files for you, or do you want to know how to code up your own converter? If you want to write code, this is a better fit for stackoverflow. – ObscureRobot Nov 14 '11 at 16:56
Found the answer. The bytes from encoded a-law sound are left right left right i.e the fisrt is left the second is right etc and they are signed as it should. No need to convert to 16 bit and than divide two bytes. Just decode with the lookup table in the link above – Vlad Nov 15 '11 at 13:01
I thought this is not a question for stackoverflow. – Vlad Nov 15 '11 at 13:02
You should answer your own question and close it, hehe =) BTW: I think what @ObscureRobot meant to say is that this seems more like a programming question than audio/video production. – Johnny Bigoode Feb 7 '12 at 13:14

I found what was the problem. Every byte is left/right left/right etc... in that order. So to explain, a-law compression converts 16 bit pcm value to 8 bit value i.e 8 bits with a special alghorithm are cut of. So in a-law it goes 8 bits left, 8 bit right and so on...

So decoding the pcm value from a-law encoded never gives the original sound. But it is very similar.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.