Sound Stick
- Type
- Sound
- Category
- Joystick-controlled SOUND explorer
- Author
- Wendell Mollycheck
- Published in
- Antic, May 1987 (Vol. 6, No. 1)
- Year
- 1987
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, any memory size, Atari BASIC, joystick in port 1
- Tags
- antic, sound, pokey, joystick, sound-command, beginner, atari-basic
About the program
Atari BASIC's SOUND statement takes four numbers: voice, pitch, distortion (which Antic called "tone") and volume. Finding a sound you like normally means typing SOUND statements over and over. Sound Stick lets you sweep through all four with the joystick and hear the result straight away. The four current values are shown on the screen, so you can copy them into your own program.
Wendell Mollycheck wrote that it took him many evenings to strip the program down to the simplest version he could manage. Antic printed it in the May 1987 issue with an unusual footnote: the magazine couldn't say anything about the author, or pay him yet, because he hadn't sent his address or phone number.
Typing it in
It's plain text with no special characters, and only 31 lines. Antic printed it with TYPO II checksums, and the article calls the file STICK.BAS, but on the disk it is SOUNDST.BAS.
How to use it
Plug a joystick into port 1 and RUN. Nothing sounds until you raise the volume.
| Joystick | Button | Changes |
|---|---|---|
| Down / up | not pressed | Pitch number up / down (a bigger number is a lower note) |
| Down / up | held | Volume up / down |
| Right / left | held | Tone (distortion) up / down |
| Diagonal | held | Voice: up-left 0, up-right 1, down-left 2, down-right 3 |
Hold the button and push down a few times to raise the volume, then let go and move up and down to sweep the pitch. Each voice keeps sounding when you switch to another one, so you can build chords and drones from up to four layers.
How it works
The whole program is one loop. Line 100 reads STICK(0), which returns 15 at rest, 14 up, 13 down, 11 left, 7 right, and 10, 6, 9 and 5 for the diagonals. Lines 110–200 combine that with STRIG(0) (0 while the button is pressed) to nudge one of the variables A, B, C or D up or down. Line 250 sends them all to SOUND A,B,C,D, and lines 270–300 print them on the voice's own row.
There is no smoothing or delay, so the values change as fast as BASIC loops. Tap the stick rather than holding it.
Some quirks are worth knowing:
- The tone value goes up in steps of 1, but only even distortions (0–14) are real POKEY sounds. An odd number sets POKEY's "volume only" bit, so that voice goes quiet.
- The upper-limit test in line 240 is placed after
THEN D=0, so it only runs when the volume is negative, which means never. Nothing stops the pitch going past 255, so BASIC halts with an error when it does, and volumes above 15 spill over into the distortion bits. TypeRUNto start again. - Variables start at zero, so voice 0 is selected and silent when you begin.
Variations to try
- Fix line 240 by splitting it into
240 IF D<0 THEN D=0and245 IF D>15 THEN D=15, and add similar caps for B (255) and C (14). - Change
C=C+1andC=C-1to steps of 2 so that the tone moves only through the real distortion values.
Listing
10 REM SOUND STICK
20 REM BY WENDELL MOLLYCHECK
30 REM (c) 1987, ANTIC PUBLISHING
40 GRAPHICS 0:POKE 710,0
50 POKE 752,1
60 IF STRIG(0)=0 AND A=0 AND D=10 AND X=14 THEN POSITION 31,3:? " "
70 IF STRIG(0)=0 AND A=1 AND D=10 AND X=14 THEN POSITION 31,6:? " "
80 IF STRIG(0)=0 AND A=2 AND X=14 AND D=10 THEN POSITION 31,9:? " "
90 IF STRIG(0)=0 AND A=3 AND X=14 AND D=10 THEN POSITION 31,13:? " "
100 X=STICK(0)
110 IF STRIG(0)=0 AND X=13 THEN D=D+1
120 IF STRIG(0)=0 AND X=14 THEN D=D-1
130 IF STRIG(0)=0 AND X=7 THEN C=C+1
140 IF STRIG(0)=0 AND X=11 THEN C=C-1
150 IF STRIG(0)=1 AND X=13 THEN B=B+1
160 IF STRIG(0)=1 AND X=14 THEN B=B-1
170 IF STRIG(0)=0 AND X=10 THEN A=0
180 IF STRIG(0)=0 AND X=6 THEN A=1
190 IF STRIG(0)=0 AND X=9 THEN A=2
200 IF STRIG(0)=0 AND X=5 THEN A=3
210 IF A<0 THEN A=0:GOTO 100
220 IF B<0 THEN B=0:GOTO 100
230 IF C<0 THEN C=0:GOTO 100
240 IF D<0 THEN D=0:IF D>15 THEN D=15:? D:GOTO 60
250 SOUND A,B,C,D
260 POSITION 0,0:? "VOICE":POSITION 10,0:? "PITCH":POSITION 18,0:? "TONE":POSITION 25,0:? "VOLUME"
270 IF A=0 THEN POSITION 0,3:? A,B,C,D
280 IF A=1 THEN POSITION 0,6:? A,B,C,D
290 IF A=2 THEN POSITION 0,9:? A,B,C,D
300 IF A=3 THEN POSITION 0,13:? A,B,C,D
310 GOTO 50
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: SOUNDST.BAS.
Credits
- Program listing: Sound Stick — program listing (Antic, May 1987 (Vol. 6, No. 1)) — Wendell Mollycheck
- Antic, May 1987 - Vol. 6 No. 1 — article: Sound Stick by Wendell Mollycheck — Wendell Mollycheck, 1987
- Antic Software Archive — May 1987 - Vol. 6 No. 1 disk: SOUNDST.BAS — AtariMagazines.com (Kevin Savetz), 1987
