Classic Computer Magazine Archive ANTIC VOL. 2, NO. 8 / NOVEMBER 1983


Your ATARI can play most of them


Impressive sound-generating capabilities have been built into all ATARI computers. Four separate "voices" can be used to generate a wide variety of music and sound effects through the speaker in the television set. A special ATARI BASIC statement, the SOUND statement, is used to control the pitch, distortion, and loudness of each voice.

Since most chords commonly used in music involve only three to five separate notes, the four voices in the ATARI can be used in unison to play many different chords. The program which accompanies this article allows you to hear twelve different kinds of chords, in any musical key. This program can teach you a bit about musical chord structure and also how to use the sound-producing features of ATARI computers.


There are really only twelve different musical notes: C, C# (or Db), D, D# (Eb), E, F F#(Gb),G,G# (Ab), A, A# (Bb), and B. All other notes are formed by altering the pitch of one of these twelve by one or more octaves. Playing twelve notes in sequence constitutes a "chromatic scale." However, since you can start the scale at any one of the twelve notes, it follows that there are twelve different chromatic scales, each of which defines on of the twelve possible "keys" in which music can be played.

Chords are composed of certain notes selected from a particular chromatic scale. It is the "intervals" between the notes which give each chord its characteristic sound. The specific notes involved affect only the key the chord is played in, not the nature of the chord itself. For example, a major chord always consists of the 1st, 5th, and 8th notes in the chromatic scale for some key. For the key of C these notes are C, E, and G. In the key of E a major chord (F major) contains the notes, F, A, and C. The intervals remain the same as the key changes, although the actual notes played will be altered. Changing just one note in the chord can dramatically alter the sound of the chord and hence its auditory and emotional impact on the listener.

Let's return to the C major chord. There is nothing that says the lowest-pitched note in this chord must be a C. The notes can be played in any "inversion," or sequence of pitch. Some possibilities are (in order of increasing pitch): C, E, G; E,G,C;G, C, E; G, E, C; and any other sequence. If more than three notes are to be played, then one of these three must be repeated an octave (or several octaves) higher or lower. That is, the 17th note in the chromatic scale is the same as the 5th note, but is one octave higher in pitch. Adding any different notes will change the chord from C major to something else. Each inversion has its own particular sound, but the chord often sounds most characteristic when the lowest-pitched note is the first note in the scale.


The chord program shows you two menus, one for the key and one for the type of chord you wish to hear. There are only twelve possible keys, but there are many chords besides the dozen common ones included in this program. To select a chord, just enter the number for a key and then the number for the chord when the program prompts you. Any invalid entry will result in an obnoxious noise and a reminder to enter only numbers 1 through 12. The name of the chord you selected will be displayed, and arrows will appear next to the notes which constitute that chord. (If only three arrows appear, then the first note in the chroniatic scale is being duplicated one octave higher by the fourth voice.) Then press [RETURN] to play another chord, or press [ESC] to quit using the chord program.

Be very careful to type in the program correctly, and SAVE it to cassette or diskette before running it for the first time. Count the spaces in lines 70 and 80 carefully, or the menus will look funny and you may get a BASIC error number 5 at line 230 when you run the program. It might help to remember that each key name occupies five characters in the MENU1$ array, while each chord name occupies six characters in MENU2$.

The DATA statements in lines 100-130 contain the numeric pitch values for the musical notes used by the program. These were taken from Table 10-1 of the Atari BASIC Reference Manual. Errors here will result in incorrect notes being played. Notice that the computer will create sounds if pitch values between the numbers in lines 100-130 are used, but the sounds will not correspond exactly to any note in the chromatic scale.

The DATA statements in lines 150-170 contain the notes of the chromatic scale which are to be sounded for each kind of chord. For example, the first four numbers in line 150 correspond to the notes in a C major chord: the 1st, 8th, 13th (same as 1st but one octave higher), and 17th (same as 5th but one octave higher) notes in the chromatic scale starting with C. You will hear a C, G, high C, and high E for a C major chord. You can add or substitute other chords for these twelve by modifying the appropriate numbers in lines 150-170 and changing the corresponding chord name in line 80. The table below gives some other chords you might like to try.

The DATA statementes in lines 190-200 are a short machine language program called a "display list interrupt," or DLI (see ANTIC, June 1983, page 24). The DLI changes the color of the last five lines of the screen to orange with white characters, instead of green with black characters. If you don't like orange, change the 248 in line 190 to some other number. If you don't like green, change the SETCOLOR 2,12,8 statement in line 50. Typing errors in lines 190-200 may cause the computer to "lock up" so SAVE the program before running it the first time.

The rest of the program sets up the screen display, allows you to enter your chord selection, and plays the desired chord. Line 370 loads the correct pitch values into an array, and line 400 uses these values to activate the four voices. All four voices are sounded as pure tones (distortion = 10). When using several voices at once like this, the sum of all the loudness settings should not exceed 32, to avoid distortion of the sound. You may have to turn the volume on your TV set up a bit higher than normal, since the voices are all played at a loudness of only three for best sound quality. Line 410 plays the chord for about two seconds using an empty FOR/NEXT loop, then line 420 turns off all four voices.

If you want the chord to play continuously until you request a different one, then delete program lines 420-480 and change line 410 to GOTO 280. The resulting program turns your ATARI into a kind of chord organ. Try playing different sequences of chords, or "progressions" to see how they sound. You can even play songs now, but the rhythm is rather monotonous! Stop the sound and exit from the program by pressing [SYSTEM RESET].

       Table 1. Additional Chords
7sus4    1,8,11,18     7#5     1,11,17,21
7#9      1,5,11,16     7b9     1,5,11,14
13th     1,11,17,22    min13   1,11,16,22
maj13    1,12,17,22    maj9    1,5,12,15
6/9      1,5,10,15     min6    1,8,10,16

Listing:CHORDS.BAS Download