Article View: comp.dsp
Article #282Re: converting to/from compressed form
From: Lawrence Esker
Date: Tue, 26 Sep 1989 16:16
Date: Tue, 26 Sep 1989 16:16
35 lines
2379 bytes
2379 bytes
In article <RUSTY.89Sep21171741@garnet.berkeley.edu> rusty@garnet.berkeley.edu writes:
>Does anybody have any code or know where I can get my hands on some
>that would convert "normal" (uncompressed) 16 bit digital audio into
>the 8 bit u-law (or A-law) compressed form that the AM79C30 uses? Or
>point me at some references (that I could try and puzzle over; my math
>is zip)?
> rusty c. wright
I am trying this from memory, so bear with me. I'm not too sure on the sign
bit treatment. The best reference would be the data manual on the AM79C30.
First, the data is separated into inverted sign bit plus magnetude. The
magnetude is fractionalized into 0 through 7 leading zero's, four bits of
data, and trash. The number of leading zero's subtracted from 7 is converted
to binary. The compressed value is the sign bit, binary zero lead, four data
bits. Some examples:
1111 1111 1111 1111 = 1 1111 xxxxxxxxxxx = 0 111 1111
1000 0101 1110 0100 = 1 0000 1011 xxxxxxx = 0 011 1011
1001 0110 0011 1010 = 1 00 1011 xxxxxxxxx = 0 101 1011
1000 0000 0001 0000 = 1 0000000 0001 xxxx = 0 000 0001
0111 1111 1111 0000 = 0 0000000 0001 xxxx = 1 000 0001
0111 0001 1001 0110 = 0 000 1110 xxxxxxxx = 1 100 1110
0000 0000 0000 0001 = 0 1111 xxxxxxxxxxx = 1 111 1111
0000 0000 0000 0000 = no 2's complement = 1 111 1111
You can see from above that the best resolution of small signal information
is 12 bits. The least significant four or more bits of 16 bit data is
trashed. As I said before, the sign bit treatment is probably wrong. I hope
the rest was done correctly. Anyone who knows how CD players and compandors
treat polarity is welcome to correct me.
--
---------- Lawrence W. Esker ---------- Modern Amish: Thou shalt not need any
computer that is not IBM compatible.
UseNet Path: __!mailrus!sharkey!itivax!abaa!esker == esker@abaa.UUCP
Technical Details
Message-ID:
<3439@abaa.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!mailrus!ncar!tank!eecae!abaa!eskerReferences:
<RUSTY.89Sep21171741@garnet.berkeley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!mailrus!ncar!tank!eecae!abaa!esker From: esker@abaa.uucp (Lawrence Esker) Newsgroups: comp.dsp Subject: Re: converting to/from compressed form Message-ID: <3439@abaa.UUCP> Date: 26 Sep 89 16:16:12 GMT References: <RUSTY.89Sep21171741@garnet.berkeley.edu> Reply-To: esker@abaa.UUCP (Lawrence Esker) Organization: Allen Bradley Lines: 35