Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!amdahl!pacbell!varian!kinetics!zehntel!bales!nat From: nat@bales.UUCP (Nathaniel Stitt) Newsgroups: sci.electronics Subject: Re: CODEC - How to get one? Summary: mu-law look up table. Message-ID: <197@bales.UUCP> Date: 18 Oct 88 23:12:59 GMT References: <375@limbic.UUCP> Reply-To: nat@bales.UUCP (Nathaniel Stitt) Organization: Bales Scientific Inc., Walnut Creek, CA Lines: 288 In article <375@limbic.UUCP> gil@limbic.UUCP (Gil Kloepfer Jr.) writes: >Recently, I have been playing around with sound digitization, and was able >to get a peek at a commerical unit. It had a chip in it that was referred >to as a CODEC. This appears to be a A/D & D/A converter with an audio >compression that they refer to as mu and A law. > >Can anyone provide input on what the mu and A law compression schemes are, Here is a look up table I created a while back for going from 8-bit mu-law encoded samples to 13-bit signed linear samples. I generated this table from a description of mu-law from a book I got at Radio Shack, so no guarantees. You should use the 8-bit mu-law value as an unsigned 8-bit index into the table. Here is the table: short u2norm[256] = { -4016, -3888, -3760, -3632, -3504, -3376, -3248, -3120, -2992, -2864, -2736, -2608, -2480, -2352, -2224, -2096, -2000, -1936, -1872, -1808, -1744, -1680, -1616, -1552, -1488, -1424, -1360, -1296, -1232, -1168, -1104, -1040, -992, -960, -928, -896, -864, -832, -800, -768, -736, -704, -672, -640, -608, -576, -544, -512, -488, -472, -456, -440, -424, -408, -392, -376, -360, -344, -328, -312, -296, -280, -264, -248, -236, -228, -220, -212, -204, -196, -188, -180, -172, -164, -156, -148, -140, -132, -124, -116, -110, -106, -102, -98, -94, -90, -86, -82, -78, -74, -70, -66, -62, -58, -54, -50, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 4016, 3888, 3760, 3632, 3504, 3376, 3248, 3120, 2992, 2864, 2736, 2608, 2480, 2352, 2224, 2096, 2000, 1936, 1872, 1808, 1744, 1680, 1616, 1552, 1488, 1424, 1360, 1296, 1232, 1168, 1104, 1040, 992, 960, 928, 896, 864, 832, 800, 768, 736, 704, 672, 640, 608, 576, 544, 512, 488, 472, 456, 440, 424, 408, 392, 376, 360, 344, 328, 312, 296, 280, 264, 248, 236, 228, 220, 212, 204, 196, 188, 180, 172, 164, 156, 148, 140, 132, 124, 116, 110, 106, 102, 98, 94, 90, 86, 82, 78, 74, 70, 66, 62, 58, 54, 50, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; > >Gil Kloepfer, Jr. U-Net: {decuac,boulder,talcott,sbcs}!icus!limbic!gil >ICUS Software Systems Voice: (516) 968-6860 [H] (516) 746-2350 x219 [W] >P.O. Box 1 Internet: gil@icus.islp.ny.us >Islip Terrace, NY 11752 "Life's a ... well, you know..." -- Nathaniel Stitt | This life is a test. It is only a test. Had Guidelines Software, Inc. | this been an actual life, you would have received ucbvax!ucbcad!z!nat | further instructions as to what to do and where (415) 376-1395 | to go.