Subject: Re: /dev/audio works, (SPARC)tracker not
To: Olaf Seibert <firstname.lastname@example.org>
From: Timothy Newsham <email@example.com>
Date: 12/13/1994 20:13:15
> > > 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:
> On comp.sys.amiga.programmer or somesuch there has been a sort of war over this
> Basically, the proposed trick was to play one channel at maximum volume
> (playing the most significant bits of the sample) and at the same time the other
> channel at minumum volume (for the least significant bits). The actual sample
> played would be 64 * high_channel + low_channel.
Hmm.. the conversion from mu-law to linear is given by:
segment = ~(bits 4-6) (range 0 to 7)
sign = ~(bit 7) (range 0 to 1)
offset = ~(bits 0-3) (range 0 to 15)
linear = sgn(sign) * (2^segment * (offset + 33) - 33)
= sgn(sign) * 2^segment * (offset + 33 - 33/2^segment)
seems that you can easily decompose this into two channels multiplied
A = 2^segment (range 1 to 128)
B = sgn(sign) * (offset + 33 - (33/2^segment)) (range -48 to 48)
the resulting value of A modulated by B (A * B) is the linear
equivalent of the original mulaw data except for a small error
due to quantization of (33/2^segment).
Both values A and B can be placed in small lookup tables (8 bytes
and 32 bytes respectively).
Seems that mu-law can be implemented on the amiga with good quality
without much fuss.
> ___ Olaf 'Rhialto' Seibert firstname.lastname@example.org Ooey-Gooey-Fluffy-Barfie