There's more to Atari sound than meets the ear. Frank O' Dwyer shows you how it's done.
Atari Tunes Up
There's more to Atari sound than meets the ear. Frank O' Dwyer shows you how it's done
There is more to the Atari sound system than Basic's SOUND command. For instance, two channels may be compbined to give a nine octave range instead of the normal five octaves. It is also possible to raise or lower the range available to each channel selectively so that channel one, for instance, plays in a very high register while channels two to four play in a low register. In addition, special effects may be achieved by filtering channels or altering the way in which distortion is arrived at.
As you might expect, all this power must be accessed using POKEs, since there are no Basic commands to use the extra facilities. Unfortunately, as soon as you reconfigure the sound system using a POKE, the SOUND command becomes obsolete and you must use POKE for this too. This is because the SOUND command will reconfigure the system back to normal. An equivalent POKE to the SOUND command is clearly the first thing required. Actually it should be two POKEs; say we want to convert the command:
SOUND CHAN,PITCH,DISTORT,VOLUME
Then we could write:
POKE 53760+CHAN*2,PITCH:POKe 53761+CHAN*2,DISTORT*16+VOL
Unlike the SOUND command, however, there is no need to specify pitch, volume, and distortion together. Suppose you only want to vary the pitch of a note, having already set the volume and distortion. You could write:
POKE 53761,168:FOR PITCH=0 TO 255:POKE 53760,PITCH:NEXT PITCH
This will run more quickly than the equivalent Basic:
FOR PITCH=0 TO 255:SOUND 0,PITCH,10,8:NEXT PITCH
All the extra functions are accessed by POKEing location 53768, sometimes referred to as AUDCTL or 'Audio Control'.
Code Number |
Purpose |
128 | Selects 9-bit poly in place of 17-bit poly |
64 | Clock channel one with 1.79MHz |
32 | Clock channel three with 1.79MHz |
16 | Join channels one and two (nine octaves) |
8 | Join channels three and four (nine octaves) |
4 | Insert high pass filter in channel one, regulated by channel three |
2 | Insert high pass filter in channel two, regulated by channel four |
1 | Use 15KHz clock |
0 | Revert to normal functions |
Table 1. Special sound functions |
The values to POKE here are summarised in Table 1. For example, if you want a high pass filter on channel two you POKE a 2 here (POKE 53768,2).
If you want to select more than one option, simply add up the code numbers for each option and POKE the result. For example, to select a high pass filter on channel one (code number 4) and a 1.79MHz clock on channel one also (code number 64) you would write POKE 53768,64+4 or just POKE 53768,68.
Now you know how to select sound functions, what do they mean?
Clocks
There are three clocks available, 15KHz, 64KHz (normal) and 1.79MHz (the full speed of the 6502 processor). The Basic command SOUND uses the 64KHz clock to produce notes. If you select the 15KHz clock, all notes sound lower than usual, while the 1.79MHz clock makes them sound much higher. You can only clock channels one and three with the 1.79MHz clock (channels 0 and 2 in Basic), but all channels may be clocked with the 15KHz clock.
Program 1 demonstrates the notes available at each clock rate.
Special Effects
If you select code number 128 a nine-bit poly will be used in place of a 17-bit poly. 'Polys', or polynomials, are used for noise generation. There are three poly normally, 4, 5 and 17 bits long.
If you use a distortion value other than 10 or 14 in a SOUND statement then you are, whether you know it or not, using the poly counters. The 17-bit poly has no apparent repetition in the sound produced, whereas the shorter polys produce audible repetition. So selecting the 9-bit poly makes the pattern in the sound more evident. The distortion values that use the 9/17-bit poly are 0 and 8. Only these modes will be affected by selection of the 9-bit poly. Program 2 shows the effect in action.
Other effects are possible by using a high-pass filter on either channel one or two. High pass filters only allow frequencies (or notes) higher than a particular value to pass through. On the Atari, these values are governed by the notes being played by channels three and four respectively. It is normal to set the distortion of both channels to the same value and then to experiment with the pitch values to achieve special effects, since the results are very unpredictable. Try Program 3 to get an idea of what the high pass filter does.
A nine-octave range can be achieved by joining two channels to form one. For example, you could join channels one and two. The disadvantage is that you then have less channels to work with, but this is rarely a problem since most programs do not use more than two channels for sound. To set the pitch on the nine-octave channel you need to use two POKEs instead of one. If you POKE the pitch register of the first channel you make a fine adjustment in the pitch, while the second channel's pitch register makes a coarse adjustment.
Program 4 allows you to use a joystick to adjust the pitch of a nine-octave channel. Move the joystick up to raise the pitch and down to lower it. Press the trigger to make fine adjustments.
Note that the program also sets the clock to 1.79MHz to get a more useful nine-octave range. If you were to use the normal clock or the 15KHz clock you would be able to take the pitch so low that the note would lose its musical quality and just consist of infrequent clicks.
Name | Address | Purpose |
AUDF | 53760 | Sets pitch for channel one |
AUDC1 | 53761 | Sets volume and distortion for channel one |
AUDF2 | 53762 | Sets pitch for channel two |
AUDC2 | 53763 | Sets volume and distortion for channel two |
AUDF3 | 53764 | Sets pitch for channel three |
AUDC3 | 53765 | Sets volume and distortion for channel three |
AUDF4 | 53766 | Sets pitch for channel four |
AUDC4 | 53767 | Sets volume and distortion for channel four |
AUDCTL | 53768 | Selects special sound functions (See Table 1) |
Table 2. Important memory locations |