There are four independently controllable "channels", or voices (there is actually 
only one physical audio output channel). They can be thought of as oscillators that are 
always on, and who's frequency and amplitude are controlled by specific memory 
registers. For example, each of the four channels has a frequency register, and those 
registers are often referred to as AUDF1-4 (read "any of the audio frequency registers, 1 
through 4"). Their addresses are $D200 (53760), $D202 (53762), $D204 (53764), and 
$D206 (53766). 
	Being an 8-bit machine, each register can hold a number between $00 and $FF 
($ signifies hexadecimal notation), or 0 and 255 decimal. This number is then divided 
into whichever clock is clocking that particular channel (a "divide-by-N" circuit), and that 
gives you the frequency of that channel (it's not a straight division, but I haven't figured 
out exactly what happens yet). So, if you put a 2 in there, the frequency will be higher 
than if you put a 100 in there because clock/2 is going to be a bigger number than 
clock/100. Also, there are much more noticeable jumps in "pitch" if you make small 
changes in frequency with small numbers (say from changing 3 to 4) than with larger 
numbers (say from changing 234 to 233). And the 8-bit pitch resolution in general only 
gives you a few octaves to reasonably work with.
	Along with the AUDF1-4 registers, there is also a group of registers that are 
referred to as AUDC1-4 (read "any of the audio control registers, 1 through 4"). These 
audio control registers are quite special because they control things like amplitude and 
"distortion". Their addresses are $D201 (53761), $D203 (53763), $D205 (53765), and 
$D207 (53767). Here is a bit diagram for an AUDC1-4:

bit number  7  6  5               4           	3  2  1  0
           distortion	       vol only	          volume

	The volume control for each channel is pretty straightforward. The lower 4 bits of 
the audio control register contain a 4-bit number ("nybble") that specifies the volume of 
the sound. A zero in these bits means zero volume, and a 15 means as loud as 
possible. I have found that the sum of the volumes of the four channels should not be 
higher than 32 or else you will get a buzzy sound and actually lose volume.
	The upper three bits control the "distortion" amount. It's not really distortion in the 
standard sense, it actually means something closer to "noise". The Atari uses 
"polynomial counters" which are essentially shift registers with a NAND gate thrown in 
there that feeds back into the input of the register. For example, with a 5-bit poly-
counter, bit 5 is sent as the output but it is also compared with bit 3 by a NAND gate. 
The output of the NAND gate is the next input at bit 1 as everything gets shifted.
	The poly-counters are aren't truly random because they will repeat their 
sequences after a certain amount of time, and this time depends on the number of bits 
employed in the poly-counter. But compared to the pure tone of the channels, they 
sound very noisy. The poly-counter's random pulses are compared with the pulses 
coming from the frequency register, and those that match up get through and nothing 
else does. This is how the noise is introduced into the tone of the channels. The 
following are the various settings for the top three bits of AUDC1-4 to determine the 
distortion amount after the frequency registers (x means it doesn't matter if this bit is set 
or not):
0 0 0  - select using 5 bit poly then 17 bit poly, div by 2
0 x 1 - select using 5-bit poly, then div by 2
0 1 0 - select using 5-bit then 4-bit polys, div by 2
1 0 0 - select uding 17-bit poly, div by 2
1 x 1 - div by 2 (no poly coutners i.e. pure tone)
1 1 0 select using 4 bit poly, div by 2

	Bit four of the AUDC1-4 is also very special because it is the "volume only bit". 
This means that when this bit is set, the volume value in AUDC1-4 bits 0-3 is sent 
directly to the television speaker and is not modulated with the frequency specified in 
the AUDF1-4 registers. For example, say I set AUDF1 to 10000000 (128) and I set 
AUDC1 to 00000000 (0). You would hear nothing. Then by setting the bottom four bits in 
AUDC1 (setting AUDC1 to 00001111), you will hear a relatively loud tone at a frequency 
of clock-speed/AUDF1(128). Then if I set the volume only bit in AUDC1 (set AUDC1 to 
00011111), you will again here nothing. This is because the value of the lower four bits 
(the volume bits) in AUDC1 is bring sent straight to the tv speaker. If I reset these bits 
(set AUDC1 to 00010000), you will hear a single "pop" as the tv speaker cone moves 
back into a resting position.
	This "volume only" mode is very important for two reasons. Because you have 
direct control over the position of the speaker cone (thought only to a 4-bit resolution), 
with assembly language you can move it back and forth quickly enough to create 
different waves than just the pulse (1's and 0's) waves that the AUDF1-4's generate. 
Simple waves such as sine waves and sawtooth waves can be convincingly replicated. 
Secondly, you can also use it to play back stored data (i.e. samples), but once again 
only at a 4-bit resolution.
	There are other registers and tricks of importance, such as inserting high-pass 
filters, joining two channels together for 16-bit pitch resolution, or clocking the channels 
with different clocks to get different pitch ranges. There are also hardware hacks such as 
getting three independent sound outputs. As you can see, the Atari 800xl is just a friggin 
powerhouse of electronic sound and music potential, and I think represents the future of 
audio generation technology.

Brentt Dundass