A Sound Introduction: Five Sound Effects
- Type
- Sound
- Category
- Sound-effect tutorial programs
- Author
- Jim Capparell
- Published in
- Antic, October/November 1982 (Vol. 1, No. 4), "A Sound Introduction"; reprinted in The Best of Antic, Volume 1
- Year
- 1982
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, Atari BASIC
- Tags
- antic, sound, pokey, sound-effects, tutorial, beginner, jim-capparell, atari-basic
About the program
Jim Capparell, Antic's editor and publisher, wrote "A Sound Introduction" for the magazine's sound and music issue. He described POKEY as a barbershop quartet: four voices, each able to sing 255 pitches, loudly or softly, as a pure tone or "distorted" into a growl, hiss or rumble. He explained the four numbers of SOUND voice,pitch,distortion,volume (a higher pitch number gives a lower note, and distortion 10 is the purest tone) and gave a table of note values, with middle C at 121. Then he gave five short programs as starting points for experiments.
What you need
Any Atari with Atari BASIC and a TV or monitor with the sound up. Each program loops forever. Press BREAK to stop it, and type END to silence the voices.
Typing it in
All five are plain ASCII. Two of them contain a typing slip that does no harm. Line 60 of the European siren and line 160 of the sawing program say SOUND O (letter O) instead of SOUND 0. Since the variable O is never set, it equals zero and channel 0 is used anyway. In the explosion, line 100 forgets to set V2, so line 120 plays at volume 0. You can add V2=15 there and listen to the difference.
The five sounds
- Explosion. Three channels of distortion-8 noise at different pitches. Their volumes are multiplied by slightly different decay factors on each pass, so the bang dies away unevenly. Capparell suggested changing
DURin line 30 and the volumes in line 100. - Siren. One pure tone swept up and down between two pitch values. Line 100 swaps the limits and reverses the step. Try a different step size in line 60.
- European siren. The two-tone "nee-naw" made by swapping between two fixed pitches. Experiment with
LOandHIin line 40. - Whistle and bomb. Two slightly detuned tones fall in pitch and grow louder, followed by the same decaying explosion as program 1. Capparell asked readers to work out which part makes which sound.
- Sawing wood. Short pitch sweeps on distortion 2 and 8 imitate the push and pull of a saw. The article suggests removing the delay in line 180.
How it works
The only tool used is SOUND. The effects come from changing the pitch or the volume inside a loop: linear steps for the sirens, and repeated multiplication by a number just under 1 for the decaying explosion. That decay factor, ICR=0.79+DUR/100, is why a bigger DUR gives a longer bang. In the sawing program, line 150 jumps back to the start from inside a subroutine without a RETURN. That is harmless here, but avoid it in your own programs.
Listings
1. Explosion
10 REM EXPLOSION
20 REM DUR=LENGTH OF EFFECT,1-10
30 DUR=6
40 PITCH=20:GOSUB 80
50 SOUND 1,0,0,0:SOUND 2,0,0,0
60 GOTO 30
70 REM *** SUBROUTINE ***
80 SOUND 2,75,8,15
90 ICR=0.79+DUR/100
100 V1=15:V3=15:REM VOLUME
110 SOUND 0,PITCH,8,V1
120 SOUND 2,PITCH+20,8,V2
130 SOUND 2,PITCH+50,8,V3
140 V1=V1*ICR
150 V2=V2*(ICR+0.05)
160 V3=V3*(ICR+0.08)
170 IF V3>1 THEN 110
180 SOUND 0,0,0,0:RETURN
2. Siren
10 REM SIREN
20 REM DUR=TIME IN SECONDS
30 DUR=10
40 LO=50:HI=35:STP=-1
50 FOR TIME=1 TO DUR
60 FOR PITCH=LO TO HI STEP STP
70 SOUND 0,PITCH,10,14
80 FOR WAIT=1 TO 15:NEXT WAIT
90 NEXT PITCH
100 XX=LO:LO=HI:HI=XX:STP=-STP
110 NEXT TIME
120 SOUND 0,0,0,0:GOTO 30
3. European siren
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:NEXT WAIT
80 PITCH=LO:LO=HI:HI=PITCH
90 NEXT TIME
100 SOUND 0,0,0,0:GOTO 30
4. Whistle and bomb
10 REM WHISTLE & BOMB
20 REM DUR=LENGTH OF EFFECT
30 DUR=5
40 V1=4:FOR PITCH=30 TO 75
50 SOUND 0,PITCH,10,V1
60 SOUND 1,PITCH+3,10,V1*0.7
70 FOR WAIT=1 TO DUR*3:NEXT WAIT
80 V1=V1*1.03:NEXT PITCH
90 SOUND 2,35,8,12
100 V1=15:V2=15:V3=15
110 PITCH=DUR+5:ICR=0.79+DUR/100
120 SOUND 0,PITCH,8,V1
130 SOUND 1,PITCH+20,8,V2
140 SOUND 2,PITCH+50,8,V3
150 V1=V1*ICR
160 V2=V2*(ICR+0.05)
170 V3=V3*(ICR+0.08)
180 IF V3>1 THEN 120
190 SOUND 0,0,0,0:SOUND 1,0,0,0
200 SOUND 2,0,0,0:GOTO 30
5. Sawing wood
20 REM SAWING WOOD
30 REM DUR=SECONDS RUN
40 DUR=8
50 FOR TIME=1 TO DUR
60 ST=6:VL=12:GOSUB 90
70 ST=8:VL=8:GOSUB 90
80 NEXT TIME:RETURN
90 FOR PITCH=ST+5 TO ST STEP -1
100 GOSUB 160:NEXT PITCH
110 FOR PITCH=ST TO ST+5
120 GOSUB 170:NEXT PITCH
130 SOUND 0,0,0,0:SOUND 1,0,0,0
140 FOR WAIT=1 TO 25:NEXT WAIT
150 GOTO 40
160 SOUND O,PITCH,2,VL
170 SOUND 1,PITCH,8,VL*0.7
180 WAIT=(WAIT/5)*5:RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: EXPLOSN.BAS, EURSIREN.BAS, SAW.BAS, SIREN.BAS, WHISTLE.BAS, EXPLOSN.BAS, EURSIREN.BAS, SAW.BAS, SIREN.BAS, WHISTLE.BAS.
Credits
- Program listing: A Sound Introduction: Five Sound Effects — program listing (Antic, October/November 1982 (Vol. 1, No. 4), "A Sound Introduction"; reprinted in The Best of Antic, Volume 1) — Jim Capparell
- Antic article text (Best of Antic Book) — A Sound Introduction — Jim Capparell
- Antic Software Archive — disk files (Best of Antic Book): EXPLOSN.BAS, EURSIREN.BAS, SAW.BAS, SIREN.BAS, WHISTLE.BAS — AtariMagazines.com (Kevin Savetz)
- Antic Software Archive — disk files (October 1982 - Vol. 1 No. 4): EXPLOSN.BAS, EURSIREN.BAS, SAW.BAS, SIREN.BAS, WHISTLE.BAS — AtariMagazines.com (Kevin Savetz), 1982
- Antic magazine scan (OCR text layer): Antic_Vol_1-04_1982-10_Sound_and_Music_text.pdf — Internet Archive
