Subject: Re: PCM8 vs. PCM16/LINEAR?
To: None <jtk@atria.com>
From: Mike Long <mike.long@analog.com>
List: tech-kern
Date: 07/13/1995 10:58:25
>Date: Thu, 13 Jul 1995 08:20:27 -0400
>From: John Kohl <jtk@atria.com>
>
>While working on the GUS audio driver, I've been making assumptions
>about what PCM8 and PCM16 are supposed to mean for audio data formats.
>
>What is the difference between the two?  I don't think it's just sample
>size, because I recall seeing support in other drivers for both 8- and
>16-bit data in at least one of the formats.
>
>My working hypothesis has been:  PCM16/LINEAR is for 8- or 16-bit signed data;
>PCM8 is for 8-bit unsigned data.  There is no support for 16-bit
>unsigned data.  ULAW is for 8-bit Sun-style logarithmic encoding.  ALAW
>is for some format I haven't tackled yet.

The way the SunOS audio system works is such that PCM samples are
always signed numbers.

If an audio device uses unsigned samples, then there will have to be a
different encoding and/or the driver will have to be responsible for
converting it (ugh, slow).

A-law is similar to mu-law in that it nonlinearly compresses a 14-bit
linear sample into 8 bits, but the compression functions are
different.  mu-law is used in the U.S. telephone system, A-law in
European systems.

Because of the confusion involved here, I think we should get rid of
AUDIO_ENCODING_PCM8 and AUDIO_ENCODING_PCM16 from
/usr/include/sys/audioio.h.  When the driver is asked to use the
AUDIO_ENCODING_LINEAR format, it will then look at the 'precision'
member of the audio_prinfo structure to see whether it should use 8 or
16 bits.  Something will have to be done to the mixer interface to
indicate to userland code what sample sizes a given device supports.

If you can, read the SunOS audio(4) manpage.
-- 
Mike Long <mike.long@analog.com>           http://www.shore.net/~mikel
VLSI Design Engineer         finger mikel@shore.net for PGP public key
Analog Devices, CPD Division          CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA                assert(*this!=opinionof(Analog));