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

Difference btw 8 bit PCM and u-Law?

Feb 25, 2009 at 6:37 PM
Can someone explain to me the difference between an 8 bit (8kHz, 1 channel) PCM and u-Law (8 bit, 8kHz,1ch) encoded file? I was attempting to convert from the former PCM format to the later u-Law format and the WaveConversionStream threw an exception. The size of those two files appears to be the same.

-G
Coordinator
Feb 26, 2009 at 3:56 PM
Hi geiman,

The main difference is to do with dynamic range. While with 8 bit PCM, the 256 volume levels are evenly distributed, with u-law and a-law they are on a curve that improves the quality of encoding speech. Not sure why you would get the exception. Normally you go from u-law to 16 bit.

Mark
Feb 26, 2009 at 5:32 PM
From http://en.wikipedia.org/wiki/PCM, "In telephony, a standard audio signal for a single phone call is encoded as 8000 analog samples per second, of 8 bits each, giving a 64 kbit/s digital signal known as DS0. The default signal compression encoding on a DS0 is either µ-law (mu-law) PCM (North America and Japan) or A-law PCM (Europe and most of the rest of the world)."

If I receive a 16gHz, 8bit mono PCM file, it is my understanding that this will eventually be converted to u-Law to be played on a telephony device, but it does seem possible to convert any 8 bit PCM to u-Law using NAudio, so perhaps I am misunderstanding something. I always get the exception "NAudio.MmException: AcmNotPossible calling acmStreamOpen". I have tried using multiple WaveConversionStreams but have not been successful.
Apr 9, 2010 at 6:45 AM

All of the coding I've seen for converting PCM to u-Law have been for converting 16-bit samples to 8-bit. 

If you record something as 8kHz, 8 bit, mono PCM in Sound Recorder it won't let you convert it to u-Law.

I would record as 8kHz, 16 bit, mono PCM and then convert it to u-Law