🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.dsp
Article #266

Re: converting to/from compressed form

#266
From: Chip Rosenthal
Date: Sat, 23 Sep 1989 07:43
49 lines
2761 bytes
rusty@garnet.berkeley.edu writes:
>We have a Sun Sparcstation 1.  The chip inside that it uses for D/A and A/D
>is the AM79C30 Digital Subscriber Controller.  [...] I would like to take
>uncompressed digital sound samples, say generated by a [program], and feed
>it to this chip.
>
>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?

    Reference:	|Digital Telephony|, John C. Bellamy, John Wiley & Sons,
		1982, pp. 90-113.

These compression techniques are used in digital telecommunications to
try to squeeze reasonable sound quality ("toll quality") into 8-bits.

u-Law (that's "mu-law", not "you-law") compression is defined by:

			ln( 1 + u*|x| )
    F (x)  =  sgn(x) * ----------------
     u                   ln( 1 + u )

where -1 <= x <= +1, and sgn(x) is the sign function.

The compressed value is usually represented as an 8-bit signed magnitude
number:  one sign bit plus seven magnitude bits.  In this scheme, the
most positive number is 0111111, the most negative number is 11111111,
00000000 is a positive zero, and 1000000 is a negative zero.

The u-Law expansion formula is:

     -1               1               |y|
    F (y) = sgn(y) * --- * [ ( 1 + u )   - 1 ]
     u                u

In modern telephony, a value of u=255 is used.  The first digital
telecommunication systems (the "D1" channel bank) used u=100, but with
the introduction of the "D2" channel bank a value of u=255 was selected
to simplify the conversion process.  This value allows Fu(x) to be easily
approximated by 15 linear segments.  This feature is not so important these
days since it's easy enough to build a conversion lookup table into ROM.

Please see Bellamy for more information on the linear approximation
technique and details on constructing ROM lookup tables.  A-Law companding
is also discussed there.  u-Law is used primarily in the North American
and Japanese telecommunications networks, while A-Law is used in Europe.
-- 
Chip Rosenthal / chip@vector.Dallas.TX.US / Dallas Semiconductor / 214-450-5337
Someday the whole country will be one big "Metroplex" - Zippy's friend Griffy
Technical Details
Message-ID: <749@vector.Dallas.TX.US>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ginosko!aplcen!haven!rutgers!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!gryphon!vector!chip
References: <RUSTY.89Sep21171741@garnet.berkeley.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ginosko!aplcen!haven!rutgers!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!gryphon!vector!chip
From: chip@vector.Dallas.TX.US (Chip Rosenthal)
Newsgroups: comp.dsp
Subject: Re: converting to/from compressed form
Message-ID: <749@vector.Dallas.TX.US>
Date: 23 Sep 89 07:43:10 GMT
References: <RUSTY.89Sep21171741@garnet.berkeley.edu>
Reply-To: chip@vector.Dallas.TX.US (Chip Rosenthal)
Organization: Dallas Semiconductor
Lines: 49