maverick@fir.berkeley.edu (Vance Maverick) (08/01/90)
(I'm sure this has been discussed within recent memory, but apparently not within my own useful memory.) The SPARCstation plays audio data which has been compressed from a 12-bit range to an 8-bit range, using a (presumably) nonlinear mapping for better signal-to-noise ratio at low amplitudes. Where can I find out just what this mapping is? The subject is glossed over lightly in the Sun documentation. Thanks, Vance
chip@chinacat.Unicom.COM (Chip Rosenthal) (08/01/90)
In article <26618@pasteur.Berkeley.EDU> maverick@fir.berkeley.edu (Vance Maverick) writes: > The SPARCstation plays audio data which has been compressed from a >12-bit range to an 8-bit range, using a (presumably) nonlinear mapping >for better signal-to-noise ratio at low amplitudes. Where can I find >out just what this mapping is? A blast from the past... |From chip Sat Sep 23 02:43:11 CDT 1989 |Newsgroups: comp.dsp |Subject: Re: converting to/from compressed form |References: <RUSTY.89Sep21171741@garnet.berkeley.edu> | |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 | You aren't some icon carved out chip@chinacat.Unicom.COM | of soap, sent down here to clean Unicom Systems Development, 512-482-8260 | up my reputation. -John Hiatt