Subject: Re: /dev/audio works, (SPARC)tracker not
To: Timothy Newsham <newsham@wiliki.eng.hawaii.EDU>
From: Stephen Champion <>
List: amiga
Date: 12/10/1994 10:36:38
> > Just a suggestion: Why not using 2 channels to play u-law encoded sound? 
> > That way you can use one channel for 8-bit samples and the other channel
> > to modulate the volume (6-bit) to achieve a net result of 14-bit (= full
> > u-law linear range).
> Strangely enough I was thinking about this and wondering if it was
> possible, and if so, how practical it was.  Using volume to modulate
> might not get you 12 bits.  There 8bit data and 6 bit volume but
> many of the combinations of A x B are repeats, and not all values
> can be obtained with A x B.  (btw.  volume x data just takes one
> channel,  but the hardware does support modulating one channel with
> another I believe, that would give you 8 bits each right?)
> I guess its well suited to mu-law though since there are many
> 12-bit combinations that are not represented by 8bit mulaw codes.
> This might work nicely but it would eat up all four of your channels
> for stereo output.  I might look into this further later on as
> an optional setting.
> btw.  has anyone done this before?

	As it happens, the Hardware Reference Manual describes exactly how to 
do it.  By setting the mask in ADKCON, you can define the interaction of the 
channels for modulation of both period and volume.  Specifically:

Bit	7	ATPER3		#3 modulates nothing (disable output)
	6	ATPER2		#2 modulates period of #3
	5	ATPER1		#1 -> period of #2
	4	ATPER0		#0 -> period of #1
	3	ATVOL3		#3 disabled
	2	ATVOL2		#2 -> volume of #3
	1	ATVOL1		#1 -> vol. of #2
	0	ATVOL0		#0 -> vol. of #1

	There's an example in there of how to do it, too.  Nifty thing, you can 
use a single channel for both period and volume modulation, with the data 

	Personally, I'd rather have 2 channels of higher quality audio than
4 channels of the old 8 bit.  How often do you actually come across a use for
4 channels when each pair comes out the same side anyway?  Only existing use I
know of would be for compatibility with MODs, but how many people actually plan 
on listening to "das boot" under NetBSD?  In any case, backwards compatibility 
can be maintained through flags on the audio device when it's opened.  The most
likely format to run into under NetBSD is Sun's .au, which are u_law.  Playing 
those as well as possible would have the most benefit for general purpose audio.

	Right now, I'm working with signed words with a computer music class.
Converting those to 8bit and playing under AmigaDos is *awful*, and pretty much
useless.  If I get those to play half-decently under NetBSD, I'd be an even 
happier NetBSD'er.

//  Stephen Champion                   Amiga 3000/25    NetBSD 1.0
//            Binary Arithmetic Student
//         Only the ignorant know everything.
#include "/usr/local/doc/disclaimer"