Two channels
The TIA has two identical, independent sound circuits. Each has three write-only registers: AUDC0/AUDC1 ($15, $16) choose the kind of sound, AUDF0/AUDF1 ($17, $18) the pitch, AUDV0/AUDV1 ($19, $1A) the volume. The two outputs are mixed into one mono signal. Sources: the Stella Programmer’s Guide (sound, TIA detailed description 11, and the address detail list), the Atari 2600 Specifications by Martin Korth (Nocash, audio chapter) for the rates, the pattern lengths and the polynomial formulas, and the Stella emulator’s AudioChannel.cxx and Audio.cxx (commit 8dd5600, text read, not copied) for the structure of the counters.
The registers
- AUDV (4 bits): the volume. 0 is silent and 15 is the loudest. In the chip, four driver transistors, each twice as large as the one before, pull the output pad down in a binary sequence, so the 16 codes give 16 steps (Guide, 11C). Turning a sound off with
AUDV= 0 is the right way: the Guide says that on SECAM settingAUDCto 0 gives “an obnoxious background sound”. - AUDF (5 bits): the divider. The clock of the sound circuit (the Guide: “approximately 30 KHz”, from the horizontal counter) is divided by AUDF + 1, from 1 (code 0) to 32 (code 31): from about 30 kHz down to about 1 kHz. Nocash gives the exact rate: the sound clock ticks twice per line, at the colour clock divided by 114, which is 31,399.5 Hz on NTSC (3.579545 MHz / 114) and 31,113.1 Hz on PAL (3.546894 MHz / 114). Stella’s
Audio.cxxagrees on the twice per 228-clock line. - AUDC (4 bits): the noise type and the extra divider, in the table below.
The sixteen AUDC types
The control code selects a feedback pattern for the shift counters or a plain divider. The first two columns are the Guide’s list; the length is how many clock steps the pattern repeats after (Nocash):
| AUDC | Sound (Guide) | Pattern length (Nocash) |
|---|---|---|
| 0 | set to 1 (a constant level: silent) | 1 |
| 1 | 4-bit poly | 15 |
| 2 | div 15, then 4-bit poly | 465 |
| 3 | 5-bit poly, then 4-bit poly | 465 |
| 4 | div 2: pure tone | 2 |
| 5 | div 2: pure tone | 2 |
| 6 | div 31: pure tone | 31 |
| 7 | 5-bit poly, then div 2 | 31 |
| 8 | 9-bit poly (white noise) | 511 |
| 9 | 5-bit poly | 31 |
| 10 ($A) | div 31: pure tone | 31 |
| 11 ($B) | set last 4 bits to 1 (a constant level: silent) | 1 |
| 12 ($C) | div 6: pure tone | 6 |
| 13 ($D) | div 6: pure tone | 6 |
| 14 ($E) | div 93: pure tone | 93 |
| 15 ($F) | 5-bit poly, div 6 | 93 |
Nocash’s notes on the types: 7 sounds exactly like 9 (the div 2 only matters if it were clocked by its own transitions); 4 and 5 give one high and one low step; 6 and 10 give a tone of 18 high and 13 low steps; 12 and 13 work like 4 and 5 but act on every third transition; 14 and 15 work like 6 and 7 on every third transition; 0 and 11 hold a constant high level. Types 2 and 3 are the awkward ones: type 2 takes the next 4-bit poly step on each div 31 transition, so each 4-bit poly bit lasts 18 or 13 steps; type 3 runs the 5-bit poly every step and the 4-bit poly only while the 5-bit poly’s carry is 1.
The polynomial counters shift right; the rightmost bit is the sound level (0 low, 1 high) and a new leftmost bit is the exclusive-or of two bits (Nocash): the 4-bit poly abcd gives d and shifts in c xor d; the 5-bit poly abcde shifts in c xor e; the 9-bit poly abcdefghi shifts in e xor i. All counters start at all ones, so the 4-bit poly runs 1111, 0111, 0011, 0001, 1000, 0100, ... for 15 steps. Stella’s AudioChannel.cxx models the channel as a 5-bit divider counter (counting to AUDF, wrapping at 31), a 5-bit noise counter and a 4-bit pulse counter, with the low two bits of AUDC choosing how the pulse counter is held and fed back and the high two bits choosing the pulse feedback; that is the same family of patterns drawn as hardware.
Pitch of a pure tone
The frequency of a pure tone is the sound clock divided by (AUDF + 1) and then by the divider of the type: 2 (types 4 and 5), 6 (types 12 and 13), 31 (types 6 and 10) or 93 (type 14). So the range is about 31,400 / 32 / 93 = 10.6 Hz to 31,400 / 1 / 2 = 15.7 kHz (Nocash: “circa 10 Hz..15 kHz”). For noise types the same divider sets the speed of the pattern. The table gives, for every AUDF value, the tone in Hz for NTSC and PAL (sound clock 31,399.52 and 31,113.11 Hz), computed as clock / (AUDF + 1) / divider and rounded to 0.1 Hz. The Guide says only that a PAL console sounds a little lower because of the slower crystal.
| AUDF | div 2 (types 4, 5) | div 6 (types 12, 13) | div 31 (types 6, 10) | div 93 (type 14) | ||||
|---|---|---|---|---|---|---|---|---|
| NTSC | PAL | NTSC | PAL | NTSC | PAL | NTSC | PAL | |
| 0 | 15699.8 | 15556.6 | 5233.3 | 5185.5 | 1012.9 | 1003.6 | 337.6 | 334.5 |
| 1 | 7849.9 | 7778.3 | 2616.6 | 2592.8 | 506.4 | 501.8 | 168.8 | 167.3 |
| 2 | 5233.3 | 5185.5 | 1744.4 | 1728.5 | 337.6 | 334.5 | 112.5 | 111.5 |
| 3 | 3924.9 | 3889.1 | 1308.3 | 1296.4 | 253.2 | 250.9 | 84.4 | 83.6 |
| 4 | 3140.0 | 3111.3 | 1046.7 | 1037.1 | 202.6 | 200.7 | 67.5 | 66.9 |
| 5 | 2616.6 | 2592.8 | 872.2 | 864.3 | 168.8 | 167.3 | 56.3 | 55.8 |
| 6 | 2242.8 | 2222.4 | 747.6 | 740.8 | 144.7 | 143.4 | 48.2 | 47.8 |
| 7 | 1962.5 | 1944.6 | 654.2 | 648.2 | 126.6 | 125.5 | 42.2 | 41.8 |
| 8 | 1744.4 | 1728.5 | 581.5 | 576.2 | 112.5 | 111.5 | 37.5 | 37.2 |
| 9 | 1570.0 | 1555.7 | 523.3 | 518.6 | 101.3 | 100.4 | 33.8 | 33.5 |
| 10 | 1427.3 | 1414.2 | 475.8 | 471.4 | 92.1 | 91.2 | 30.7 | 30.4 |
| 11 | 1308.3 | 1296.4 | 436.1 | 432.1 | 84.4 | 83.6 | 28.1 | 27.9 |
| 12 | 1207.7 | 1196.7 | 402.6 | 398.9 | 77.9 | 77.2 | 26.0 | 25.7 |
| 13 | 1121.4 | 1111.2 | 373.8 | 370.4 | 72.3 | 71.7 | 24.1 | 23.9 |
| 14 | 1046.7 | 1037.1 | 348.9 | 345.7 | 67.5 | 66.9 | 22.5 | 22.3 |
| 15 | 981.2 | 972.3 | 327.1 | 324.1 | 63.3 | 62.7 | 21.1 | 20.9 |
| 16 | 923.5 | 915.1 | 307.8 | 305.0 | 59.6 | 59.0 | 19.9 | 19.7 |
| 17 | 872.2 | 864.3 | 290.7 | 288.1 | 56.3 | 55.8 | 18.8 | 18.6 |
| 18 | 826.3 | 818.8 | 275.4 | 272.9 | 53.3 | 52.8 | 17.8 | 17.6 |
| 19 | 785.0 | 777.8 | 261.7 | 259.3 | 50.6 | 50.2 | 16.9 | 16.7 |
| 20 | 747.6 | 740.8 | 249.2 | 246.9 | 48.2 | 47.8 | 16.1 | 15.9 |
| 21 | 713.6 | 707.1 | 237.9 | 235.7 | 46.0 | 45.6 | 15.3 | 15.2 |
| 22 | 682.6 | 676.4 | 227.5 | 225.5 | 44.0 | 43.6 | 14.7 | 14.5 |
| 23 | 654.2 | 648.2 | 218.1 | 216.1 | 42.2 | 41.8 | 14.1 | 13.9 |
| 24 | 628.0 | 622.3 | 209.3 | 207.4 | 40.5 | 40.1 | 13.5 | 13.4 |
| 25 | 603.8 | 598.3 | 201.3 | 199.4 | 39.0 | 38.6 | 13.0 | 12.9 |
| 26 | 581.5 | 576.2 | 193.8 | 192.1 | 37.5 | 37.2 | 12.5 | 12.4 |
| 27 | 560.7 | 555.6 | 186.9 | 185.2 | 36.2 | 35.8 | 12.1 | 11.9 |
| 28 | 541.4 | 536.4 | 180.5 | 178.8 | 34.9 | 34.6 | 11.6 | 11.5 |
| 29 | 523.3 | 518.6 | 174.4 | 172.9 | 33.8 | 33.5 | 11.3 | 11.2 |
| 30 | 506.4 | 501.8 | 168.8 | 167.3 | 32.7 | 32.4 | 10.9 | 10.8 |
| 31 | 490.6 | 486.1 | 163.5 | 162.0 | 31.7 | 31.4 | 10.6 | 10.5 |
The sound is a square wave of this frequency for types 4, 5, 12 and 13. Types 6 and 10 give 18 high and 13 low steps in 31 (a duty cycle of 58 %), and 14 gives a tone of 93 steps that is not exactly square; the pitch is still the one in the table.
Not described
Known, not yet covered
- Reference: the bit-by-bit stream of every noise type (only the lengths and the shift rules are given), the exact mixing of the two channels in the analogue output and the real output voltage for each volume. No source read gives a measurement of the analogue stage.
Unknown
- Reference: the exact behaviour of types 2 and 3 on a real chip is Nocash’s reverse-engineered description, not a data sheet; the Programmer’s Guide gives only the names. The figure 7 audio circuit of the Guide is a drawing and could not be read as text.