By Jim Capparell
A Sound Introduction
Many new users have not realized the tremendous potential for music and sound hidden in their ATARI computers. After all, a computer that can produce phaser noise or let you hear Indianapolis cars race down the straightaway, by altering a few simple commands, should be capable of more.
The following applies to both the 400 and 800 and is completely memory independent.
Sound on the ATARI is really made possible by the same technology that brought you hand-held calculators. I'm talking about the integrated circuit. In this case a special integrated circuit was designed and named POKEY (Pots and Keys). Every ATARI built has this special chip and therefore can play music and generate interesting sounds.
You might think of POKEY as a barber shop quartet, since there are four voices available. Each voice can be turned up loud or so low it can barely be heard. Each barber (voice) can "sing" or sound 255 different notes or pitches. Some of these are so similar your ear can't distinguish the differences. Among them are several that correspond to the musical scale (see Table 1). Each voice can be made to sound a pure toneŅas if you were to whistle the noteŅor distort the tone. Distortion is one way of taking a familiar note and making it sound like a growl, hiss or rumble.
Let's put this in the context of the standard ATARI BASIC statements.
SOUND A,B,C,D is the general for kmat to generate sound, where:
A=Voice, one of the four barbers. A can equal any value from 0 to 3.
B=Pitch or note. This can equal any number from 1 to 255. The higher the value the lower the note.
C=Distortion. Any even number from 0 to 14. Ten gives the purest tone with least distortion.
D=Volume. Any number from 1 to 15 is legal. A zero turns sound off.
That seems pretty easy, and so it is. Try this! SOUND 0,121,10,8 [press return]. This will cause the first barber (his number is zero) to sing middle C with as little distortion as possible. Now vary the volume; try a 4 and then a 14. Eight is a good volume value when more than one barber is singing. Experiment with Distortion; change the 10 to a 4, then a 14. Restore the sound statement as it is above. Now, add a second barber.
SOUND 1,72,10,8 This voice sings the note A above C.
SOUND 2,45,10,8 This voice sings the note F.
SOUND 3,193,10,8 This sings E below middle C.
Turn off each barber's voice by making the corresponding volume 0. To turn off all voices, type END.
The legal abbreviation for the SOUND command is SO.; try it and save typing.
The following sounds should be experimented with. They are presented to get the wheels turning. I'm sure you can all do much better.
Our first sound is an explosion. Change the value of DUR in line 30. Experiment with volume changes in line 90.
Listing: EXPLOSN.BAS Download
Sound number two is a familiar siren. Change the DUR value in line 30. Try varying the step size in line 60.
Listing: SIREN.BAS Download
Sound number three is a European variation of the siren. Run it, you'll hear the difference. Experiment with the LO and HI values in line 40.
10 REM EUROPEAN SIREN 20 REM DUR=SECONDS RUN 30 DUR==5 40 LO=57: HI=45: PITCH=HI 50 FOR TIME=0 TO DUR*2 60 SOUND O, PITCH , 10 , 14 70 FOR WAIT=1 TO 180 tNEXT WAIT 80 PITCH=LO: LO=HI: HI=PITCH 90 NEXT TIME 100 SOUND 0,0,0,0:GOTO 30Listing: EURSIREN.BAS Download
Sound four is the whistle and explosion of a falling bomb. Try to determine what makes the whistle sound and what part of the program makes the explosion sound.
Listing: WHISTLE.BAS Download
Sawing wood is sound five. Try changing the pitch and volume. Also eliminate the wait in line 180.
Listing: SAW.BAS Download
There are many opportunities for the experimenter using the sound command. Perhaps a program using the joystick to vary pitch or distortion would make your experimentation easier. Random notes and harmonies can be very interesting. Look up and use the Random command in your BASIC Reference Manual. If you should write something interesting let us know, ANTIC is always looking for new, interesting and helpful material.