From alsa-devel-owner@alsa.jcu.cz  Tue Jan 19 22:03:37 1999
Received: from lacrosse.redhat.com (IDENT:sopwith@lacrosse.redhat.com [207.175.42.154])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id WAA17461
	for <alsa-devel@alsa.jcu.cz>; Tue, 19 Jan 1999 22:02:12 +0100
Received: from localhost (sopwith@localhost)
	by lacrosse.redhat.com (8.8.7/8.8.7) with ESMTP id QAA00792;
	Tue, 19 Jan 1999 16:01:58 -0500
Date: Tue, 19 Jan 1999 16:01:57 -0500 (EST)
From: Elliot Lee <sopwith@redhat.com>
To: Jaroslav Kysela <perex@jcu.cz>
cc: alsa-devel@alsa.jcu.cz
Subject: Re: hi-res pcm sound support
In-Reply-To: <Pine.LNX.3.96.990119095205.25743I-100000@entry.jcu.cz>
Message-ID: <Pine.LNX.4.04.9901191512160.10458-100000@lacrosse.redhat.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Tue, 19 Jan 1999, Jaroslav Kysela wrote:

> > Does the ALSA architecture have room for higher resolution (e.g. 24-bit
> > 96Khz) PCM sound recording and playback? The asound.h that I looked at
> > only said anything about 8 and 16-bit sound.
> > 
> > It would be really nice if someone with a professional audio background
> > would ensure that ALSA has everything needed for pro sound production.
> 
> It is possible enhance API for more than 16-bit resolution, but as I asked
> before (without any answer yet): How are 16+-bit samples encoded to
> stream? How bytesex is used (one or both)?

The endianness that sound cards expect and samples use varies, but other
than that it would seem that 24-bit numbers follow the same endianness
rules as 16-bit numbers, you just need three bytes instead of two...?

The .wav file standard (available at http://www.wotsit.org/) says:

Because most CPU's read and write operations deal with 8-bit bytes, it was
decided that a sample point should be rounded up to a size which is a
multiple of 8 when stored in a WAVE. This makes the WAVE easier to read
into memory. If your ADC produces a sample point from 1 to 8 bits wide, a
sample point should be stored in a WAVE as an 8-bit byte (ie, unsigned
char). If your ADC produces a sample point from 9 to 16 bits wide, a
sample point should be stored in a WAVE as a 16-bit word (ie, signed
short). If your ADC produces a sample point from 17 to 24 bits wide, a
sample point should be stored in a WAVE as three bytes. If your ADC
produces a sample point from 25 to 32 bits wide, a sample point should be
stored in a WAVE as a 32-bit doubleword (ie, signed long). Etc.

And since WAVE samples are stored little-endian, the 24-bit number would
be stored as such.

That's what I've managed to figure so far,
-- Elliot
"In film you will find four basic story lines. Man versus man, man
 versus nature, nature versus nature, and dog versus vampire."
    - Steven Spielberg



