A COMMENT
When writing an article I always try to do something which will encourage others to try their hand at learning to program for themself. While SOUNDER is a working program, it is open to improvement and I hope some of you will do just that. You may want to allow for larger files, add new routines, or anything that you think will make it better. How about adding a Catalog file?
SOME PARTICULARS
The program starts out by going to a subroutine which draws the logo for the opening screen at line 580. After this it draws the working screen at line 25. Then comes the routine for adding the screen commands at line 95.
Next comes the main part of the program starting at line 145. Here we have a part of the program which keeps track of the command keys that are pressed by the User. [If for example the User presses the “8” key, a jump is made to a Subroutine which keeps track of seeing if the key is still pressed and starts the amount (Amt) going upward in value. If the key is released, then the program is RETURNed to where it came from. The same thing happens in reverse for the countdown routine.
All other routines are sensed from the keyboard in the same manner as the above. It is which key has been pressed that determines which sub-routine the program goes to. These Subs are labled according to their function. For example: GOSUB tape makes the program do the TAPE routine at line 350.
Use the 8 & 5 keys to change the value of each register for the particular sound you wish to make. Press six to move to the next register and then follow the menu at the bottom of the screen to sound off, Retain, or SAVE the values.
THE MEMORY
The memory which is used to store the values for the Registers is broken into two parts; one holds the register numbers (at 59000), and the other saves the values which go into the registers (at 60000). These locations were picked because they are high in memory. Why are they split into two groups? I felt it was easier from a programing view to do so. It allows one variable to count for both locations rather than having them at one location and having to alternate the values.
TAPE IT
Once the TAPE option has been chosen, the two memory locations which hold the data for the sound program(s) is altered and put into one location for ease of handling to tape. The two locations are PEEKED and then stored in location 58000. The data is saved in alternate fashion; first the register number and then a value of that given register.
GET A SOUND
When a request for a sound is made from the keyboard, a prompt asks for either ALL or LAST entry. Here is an area which may be altered to suit your needs. The routine begins at line 270. Either choice is routed to the proper routine. One will allow only the last 13 entries to be called up. The other will call all the memory up to a given limit which you may set. Default is 20 complete register pairs (13*20).
WHY DIDN’T I?
Why didn’t I make it more elaborate? The first thing a program should be is User friendly. It should not burden the User with to many commands which are hard to remember. The more the program grows (as a rule), the harder it gets to use easily. Number two, it was left this way with hopes that some of you would taylor it to your liking. Have I changed it much since the beginning? You bet! All ideas may be improved upon with enough thinking!
SOME THOUGHTS
How about sound routines that may be entered into a question and answer type program which would produce some wierd noises for the wrong or right answers? Looking for that “spacey” sound? Try some of the basic sounds given in your manual and go from there. Have you tried immitating a cricket? How about a frog? Sounds are of unlimited supply, it’s up to you.
ATTACK AND FALL
Well ok, it’s decay, not fall. Sounds which you hear every day are produced with these two terms. Attack is simply how fast a sound reaches it maximum peak level. Decay is how long it takes it to drop back off. Now as for the cricket, it has (I think) about an even attack and decay range. That gives us approximently a SAWTOOTH wave form. See page 193 of your manual: Fig 10. Now if the sound were very fast in rising (attack) and slower in falling off (decay), then fig 8 would fill the bill.
AND THERE
You have it. These are some basic ideas to help you in getting started. The rest is up to you. Try it out and have some fun.
Products
Media
Image Gallery
Source Code
5 REM sound Routine-Enters sound frim keyboard
10 GO SUB 580
15 GO SUB 550: REM setup vars
20 REM PRINT LOGO SCREEN
25 REM 2ND SCREEN
30 PRINT AT P,0;"\ : ": LET P=P+1
35 IF P=22 THEN GO TO 45
40 GO TO 30
45 LET P=1
50 PRINT AT 21,P;"\..": LET P=P+1: IF P=31 THEN GO TO 60
55 GO TO 50
60 LET P=21
65 PRINT AT P,31;"\: ": LET P=P-1: IF P=-1 THEN GO TO 75
70 GO TO 65
75 LET P=30
80 PRINT AT 0,P;"\..": LET P=P-1: IF P=0 THEN GO TO 90
85 GO TO 80
90 REM PRINT SCREEN DATA
95 PRINT AT 0,1;"REGISTERS ";AT 0,12;"VALUES ";AT 0,20;"FUNCTIONS "
100 PRINT AT 2,5;"0";AT 2,21;"Fine Tune";AT 3,5;"1";AT 3,21;"C Tune"
105 PRINT AT 4,5;"2";AT 4,21;"Fine Tune";AT 5,5;"3";AT 5,21;"C Tune"
110 PRINT AT 6,5;"4";AT 6,21;"Fine Tune";AT 7,5;"5";AT 7,21;"C Tune";AT 8,5;"6";AT 8,21;"Noise"
115 PRINT AT 9,5;"7";AT 9,21;"Enable";AT 10,5;"8";AT 10,21;"Amplitude";AT 11,5;"9";AT 11,21;"Amplitude"
120 PRINT AT 12,5;"10";AT 12,21;"16 Enables";AT 13,5;"11";AT 13,21;"FT-Time"
125 PRINT AT 14,5;"12";AT 14,21;"CT-Tune";AT 15,5;"13";AT 15,21;"Shape"
130 PLOT 5,40: DRAW 245,0
135 PRINT AT 16,2;"REG #";AT 17,2;"1-HOLD S-SOUND";AT 18,2;"2-ALTERNATE E-ERASE";AT 19,2;"4-ATTACK R-SAVE";AT 20,2;"8-RETAIN"
140 PRINT AT 20,14;"T-TAPE ";AT 17,23;AT 18,23;"D-VALS";AT 19,26;"TO";AT 20,24;"SCREEN"
145 LET A$=INKEY$: REM GET CURSOR KEY
150 PRINT AT R,15;"\::": IF R>2 THEN PRINT AT R-1,15;" "
155 IF A$="6" THEN GO SUB CURSOR
160 IF A$="S" OR A$="s" THEN GO TO 275
165 IF A$="D" OR A$="d" THEN GO TO 320
170 IF A$="E" OR A$="e" THEN GO SUB ERASE
175 IF A$="N" OR A$="n" THEN GO SUB NOISE
180 IF A$="T" OR A$="t" THEN GO SUB TAPE
185 IF A$="R" OR A$="r" THEN GO SUB SAVE
195 IF A$="8" THEN GO SUB CUP
200 IF A$="5" AND AMT>0 THEN GO SUB CDOWN
205 GO TO 145
210 REM MOVE CURSOR
215 LET R=R+1
220 IF R=16 THEN PRINT AT 16,14;" ";AT 16,12;" ";AT 15,15;" ": LET R=2: PLOT 95,40: DRAW 30,0
225 RETURN
230 REM GET UP COUNT REG VALS
235 LET AMT=AMT+1
240 IF R=2 OR R=4 OR R=6 OR R=13 OR R=14 THEN PRINT AT R,12;AMT: IF AMT>255 THEN LET AMT=0: PRINT AT R,12;" "
245 IF R=3 OR R=5 OR R=7 OR R=10 OR R=11 OR R=12 OR R=15 THEN PRINT AT R,12;AMT: IF AMT>15 THEN LET AMT=0: PRINT AT R,13;" "
250 IF R=9 THEN PRINT AT R,12;AMT: IF AMT=64 THEN LET AMT=0: PRINT AT R,11;" "
255 IF R=8 THEN PRINT AT R,12;AMT: IF AMT=32 THEN LET AMT=0: PRINT AT R,11;" "
260 IF A$="R" OR A$="r" THEN BEEP .1,.05: GO SUB SAVE
265 RETURN
270 REM SOUND ROUTINE
275 CLS : INPUT "LAST sound or ALL sounds in Memory L/A ?";Q$: IF Q$="L" THEN GO TO 500
280 PRINT AT 8,5;"YOUR SOUND IS --": LET T=0: LET MEM1=59000: LET MEM2=60000: PAUSE 30
285 SOUND PEEK MEM1,PEEK MEM2: LET MEM1=MEM1+1: LET MEM2=MEM2+1: IF T=13 THEN GO TO 295
290 LET T=T+1: GO TO 285
295 PRINT AT 10,5;"PRESS ANY KEY TO QUIT.": PAUSE 0: FOR N=0 TO 13: SOUND N,0: NEXT N: CLS : GO TO 25
300 REM GET GIVEN SOUNDS
305 INPUT "WHICH SOUND GROUP 1-20) ?";GRP: REM MAY BE CHANGED TO ANY # OF GROUPS UP TO MEMORY LIMIT.LINE 929 & 840.
310 GO TO 500
315 REM VALUES TO SCREEN
320 CLS : LET C=1: LET A$=INKEY$: LET MEM1=59000: LET MEM2=60000: LET T=0
325 PRINT AT 0,0;"REGISTER #'s";AT 0,15;"VALUES";AT 0,23;"q-Quits"
330 PRINT PEEK MEM1,PEEK MEM2
335 LET MEM1=MEM1+1: LET MEM2=MEM2+1: LET T=T+1: IF T=13 THEN LET T=0: GO TO 345
340 GO TO 330
345 PRINT AT 20,0; BRIGHT 1;C; BRIGHT 0;" -GROUP OF 14 REGISTERS. ANY KEY CONTINUES."; PAUSE 0: LET C=C+1: FOR N=1 TO 14: PRINT AT N,0;" ";AT N,15;" ": LET a$=INKEY$: IF a$="q" OR a$="Q" THEN CLS : GO TO 15
346 NEXT n: CLS : GO TO 325
350 REM TAPE ROUTINE
355 CLS : PRINT AT 2,0;"THIS ROUTINE WILL CALL ALL SOUND VALUES FROM MEMORY TO TAPE.WHEN RE-LOADED THE REGISTER WILL BE THE FIRST# AND THE VALUE THE 2ND.# . ALTERNATED ORDER."
360 PRINT FLASH 1;AT 12,4;"MEMORY BEING READYED --"
365 LET P1=59000: LET P2=60000: LET P3=58000
370 POKE P3,PEEK P1: LET P1=P1+1: POKE P3,PEEK P2: LET P2=P2+1: LET P3=P3+1: IF P3=58360 THEN GO TO 380
375 GO TO 370
380 FLASH 0: CLS : SAVE "REGVALS"CODE 58000,360
385 STOP
390 REM ERASE ROUTINE
395 BEEP .2,.05
400 INPUT AT 2,5;"ARE YOU SURE ? Y/N ";Q$: IF Q$="N" OR Q$="n" THEN GO TO 25
405 LET mem1=59000: LET mem2=60000:
410 PRINT AT 2,8;"ERASING"
415 POKE MEM1,0: POKE MEM2,0: LET MEM1=MEM1+1: LET MEM2=MEM2+1: IF MEM1=59280 THEN GO TO 425
420 GO TO 415
425 PRINT AT 15,12;"ERASED": BEEP .5,.1: PAUSE 50: CLS : GO TO 15
430 GO TO 15
435 REM SAVE DATA TO MEMORY
440 POKE MEM1,R-2: POKE MEM2,AMT
445 BEEP .05,.1: PRINT AT 1,8;"DATA SAVED": PAUSE 70: PRINT AT 1,8;" ": LET MEM1=MEM1+1: LET MEM2=MEM2+1
450 IF MEM1=59280 THEN GO TO 460
455 RETURN
460 CLS : PRINT AT 10,5;"MEMORY FULL.": STOP
465 REM COUNT DOWN AMT
470 LET AMT=AMT-1
475 LET A$=INKEY$: IF A$<>"5" THEN RETURN
480 IF AMT<100 THEN PRINT AT R,14;" ";AT R,12;AMT
485 IF AMT<10 THEN PRINT AT R,13;" ";AT R,12;AMT
490 IF AMT=0 THEN LET AMT=0: PRINT AT R,13;" ": RETURN
495 GO TO 470
500 REM GET A GROUP
505 INPUT "WHICH GROUP (1-20) ?";GRP
510 LET MEM1=59000: LET MEM2=60000
515 IF GRP=1 THEN GO TO 280
520 LET MEM1=MEM1+(14*GRP): LET MEM2=MEM2+(14*GRP)
525 PRINT AT 5,5;"THAT SOUND IS --": GO TO 285
530 LET MEM1=59000: LET MEM2=60000: LET T=0
535 SOUND PEEK MEM1,PEEK MEM2: IF T=13 THEN GO TO 295
540 GO TO 535
545 REM VARIBLES
550 LET TAPE=355: LET ERASE=395: LET RETAIN=440: LET GET=305: LET DATA=235
560 LET AMT=0: LET CURSOR=215: LET CUP=235: LET CDOWN=470
565 LET n=1: LET r=2: LET c=0: LET P=1: LET A=1: DIM a(14): DIM y(14)
570 LET MEM1=59000: LET MEM2=60000: LET SAVE=440: LET D=1
575 RETURN
580 REM DRAW LOGO SCREEN
585 LET E=175: LET C=255
590 PLOT 0,E: DRAW C,0: LET E=E-1
595 IF E=145 THEN GO TO 605
600 GO TO 590
605 LET C=20
610 PLOT 0,E: DRAW C,0: LET E=E-1: IF E=125 THEN GO TO 620
615 GO TO 610
620 LET C=20
625 PLOT 0,E: DRAW C,0: DRAW C,0: LET E=E-1: IF E=110 THEN GO TO 635
630 GO TO 625
635 LET C=20
640 PLOT 0,E: DRAW C,0: LET E=E-1: IF E=95 THEN GO TO 650
645 GO TO 640
650 LET C=50
655 PLOT 0,E: DRAW C,0: DRAW 0,35: DRAW -20,0: DRAW 0,9: DRAW 40,0
660 LET E=138: LET C=225
665 PLOT 30,E: DRAW C,0: LET E=E-1: IF E=130 THEN GO TO 675
670 GO TO 665
675 PLOT 70,95: DRAW 0,30: DRAW 30,0: DRAW 0,-30: DRAW -30,0
680 PLOT 160,95: DRAW 0,30: DRAW 5,0: DRAW 30,-30: DRAW 5,0: DRAW 0,30: DRAW -30,20: DRAW -5,0
685 PLOT 75,100: DRAW 0,20: DRAW 20,0: DRAW 0,-20: DRAW -20,0
690 PLOT 160,95: DRAW 0,30: DRAW 5,0: DRAW 30,-30: DRAW 5,0: DRAW 0,-20: DRAW -30,20: DRAW -5,0
695 PLOT 110,95: DRAW 0,30: DRAW 5,0: DRAW 0,-25: DRAW 20,0: DRAW 0,25: DRAW 5,0: DRAW 0,-30: DRAW -30,0
700 PLOT 160,95: DRAW 5,0: DRAW 0,30: PLOT 220,95: DRAW 0,30: DRAW 20,0: DRAW 5,-5: DRAW 0,-20: DRAW -5,-5: DRAW -20,0
705 PLOT 225,100: DRAW 0,20: DRAW 10,0: DRAW 5,-5: DRAW 0,-10: DRAW -5,-5: DRAW -10,0
710 LET T=250
715 PLOT T,130: DRAW 0,-40:: LET T=T+1: IF T=256 THEN GO TO 725
720 GO TO 715
725 LET K=90
730 PLOT 255,K: DRAW -255,0: LET K=K-1: IF K=85 THEN GO TO 740
735 GO TO 730
740 LET E=90
745 PLOT 0,E: DRAW 50,0: LET E=E-1: IF E=0 THEN GO TO 755
750 GO TO 745
755 PLOT 70,70: DRAW 0,-40: DRAW 40,0: DRAW 0,40: DRAW -40,0
760 PLOT 60,75: DRAW 40,0: DRAW 10,-5: DRAW -40,0: DRAW -10,5: DRAW 0,-40: DRAW 10,-5
765 PLOT 75,65: DRAW 25,0: DRAW 0,-25: DRAW -25,0: DRAW 0,25: PLOT 120,60: DRAW 25,0: DRAW 5,-5: DRAW -20,0: DRAW 0,-10: DRAW 10,0: DRAW 5,-5: DRAW -10,0: DRAW 0,-10: DRAW -15,0: DRAW 0,30
770 PLOT 167,60: DRAW 25,0: DRAW 5,-5: DRAW -20,0: DRAW 0,-10: DRAW 10,0: DRAW 5,-5: DRAW -10,0: DRAW 0,-10: DRAW -15,0: DRAW 0,30
775 LET E=65
780 PLOT 75,E: DRAW 25,0: LET E=E-1: IF E=40 THEN GO TO 790
785 GO TO 780
790 LET E=20
795 PLOT 50,E: DRAW 205,0: LET E=E-1: IF E=0 THEN GO TO 805
800 GO TO 795
805 LET E=225
810 PLOT E,20: DRAW 0,70: LET E=E+1: IF E=256 THEN GO TO 820
815 GO TO 810
820 LET E=225
825 PLOT E,20: DRAW 0,70: LET E=E+1: IF E=256 THEN GO TO 845
830 GO TO 835
835 PRINT AT 20,15;"BY:"
840 LET Z=1
845 LET K=INT (RND*7): LET Z=Z+1: IF Z=30 THEN GO TO 855
850 BEEP .02,K: GO TO 845
855 PRINT AT 20,15;"Andy Centek": PAUSE 300: CLS : RETURN
860 PRINT AT 20,15;"Andy Centek": PAUSE 300: CLS : RETURN