Simple SOUND tool for MSX Basic

By Pineapple

Resident (39)

Pineapple's picture

02-10-2022, 21:13

I made a simple sound effect editor for Basic that should run on any MSX.
Let me know what you think.

10 SCREEN0:WIDTH40:KEYOFF:DEFINTA-Z:B=16:C=128:D=8:E=16:F=128:G=128:H=0
20 GOSUB350:GOSUB490:GOSUB530:GOSUB540:GOSUB550:GOSUB560:GOSUB570:GOSUB580:GOSUB590:GOSUB330
30 IFSTICK(0)=5THENGOSUB340:Y=(Y+1)MOD8:GOSUB330
40 IFSTICK(0)=1THENGOSUB340:Y=(Y+7)MOD8:GOSUB330
50 IFSTICK(0)=3ANDY=0THENA=(A+1)MOD3:GOSUB380:GOSUB490:GOSUB530:GOSUB540:GOSUB550:GOSUB560:GOSUB570:GOSUB580:GOSUB590
60 IFSTICK(0)=7ANDY=0THENA=(A+2)MOD3:GOSUB380:GOSUB490:GOSUB530:GOSUB540:GOSUB550:GOSUB560:GOSUB570:GOSUB580:GOSUB590
70 IFSTICK(0)=3ANDY=1THENB=(B+1)MOD17:GOSUB530
80 IFSTICK(0)=7ANDY=1THENB=(B+16)MOD17:GOSUB530
90 IFSTICK(0)=3ANDY=2THENC=(C+1)MOD256:GOSUB540
100 IFSTICK(0)=7ANDY=2THENC=(C+255)MOD256:GOSUB540
110 IFSTICK(0)=3ANDY=3THEND=(D+1)MOD16:GOSUB550
120 IFSTICK(0)=7ANDY=3THEND=(D+15)MOD16:GOSUB550
130 IFSTICK(0)=3ANDY=4THENE=(E+1)MOD32:GOSUB560
140 IFSTICK(0)=7ANDY=4THENE=(E+31)MOD32:GOSUB560
150 IFSTICK(0)=3ANDY=5THENF=(F+1)MOD256:GOSUB570
160 IFSTICK(0)=7ANDY=5THENF=(F+255)MOD256:GOSUB570
170 IFSTICK(0)=3ANDY=6THENG=(G+1)MOD256:GOSUB580
180 IFSTICK(0)=7ANDY=6THENG=(G+255)MOD256:GOSUB580
190 IFSTICK(0)=3ANDY=7THENH=(H+1)MOD16:GOSUB590
200 IFSTICK(0)=7ANDY=7THENH=(H+15)MOD16:GOSUB590
210 A$=INKEY$
220 IFA$=CHR$(27)THENBEEP
230 IFA$="r"THENC=RND(-TIME)*255:D=RND(-TIME)*15:E=RND(-TIME)*31:F=RND(-TIME)*255:G=RND(-TIME)*255:H=RND(-TIME)*15:GOSUB490:GOSUB530:GOSUB540:GOSUB550:GOSUB560:GOSUB570:GOSUB580:GOSUB590
240 IFA$="s"ANDA=0THENCLS:PRINT"SOUND7,&B10111110:SOUND8,"+MID$(STR$(B),2,3)+":SOUND0,"+MID$(STR$(C),2,3)+":SOUND1,"+MID$(STR$(D),2,3)+":SOUND11,"+MID$(STR$(F),2,3)+":SOUND12,"+MID$(STR$(G),2,3)+":SOUND13,"+MID$(STR$(H),2,3):END
250 IFA$="s"ANDA=1THENCLS:PRINT"SOUND7,&B10110111:SOUND8,"+MID$(STR$(B),2,3)+":SOUND6,"+MID$(STR$(E),2,3)+":SOUND11,"+MID$(STR$(F),2,3)+":SOUND12,"+MID$(STR$(G),2,3)+":SOUND13,"+MID$(STR$(H),2,3):END
260 IFA$="s"ANDA=2THENCLS:PRINT"SOUND7,&B10110110:SOUND8,"+MID$(STR$(B),2,3)+":SOUND6,"+MID$(STR$(E),2,3)+":SOUND0,"+MID$(STR$(C),2,3)+":SOUND1,"+MID$(STR$(D),2,3)+":SOUND11,"+MID$(STR$(F),2,3)+":SOUND12,"+MID$(STR$(G),2,3)+":SOUND13,"+MID$(STR$(H),2,3)
270 IFA$="s"ANDA=2THENEND
280 IF STRIG(0)=0THENT=0
290 IFA=0ANDSTRIG(0)=-1ANDT=0THENT=1:SOUND7,&B10111110:SOUND8,B:SOUND0,C:SOUND1,D:SOUND11,F:SOUND12,G:SOUND13,H
300 IFA=1ANDSTRIG(0)=-1ANDT=0THENT=1:SOUND7,&B10110111:SOUND8,B:SOUND6,E:SOUND11,F:SOUND12,G:SOUND13,H
310 IFA=2ANDSTRIG(0)=-1ANDT=0THENT=1:SOUND7,&B10110110:SOUND8,B:SOUND6,E:SOUND0,C:SOUND1,D:SOUND11,F:SOUND12,G:SOUND13,H
320 GOTO 30
330 LOCATE0,(Y*2)+3:PRINT"=>":RETURN
340 LOCATE0,(Y*2)+3:PRINT"  ":RETURN
350 LOCATE 5,0:PRINT"-MSX BASIC SFX Generator Tool-"
360 LOCATE10,3:PRINT"Sound Type: (       )"
370 LOCATE14,5:PRINT"Volume: (       ) *"
380 LOCATE11,7:PRINT"Tone Fine: (       ) "+CHR$(42-(AMOD2)*10)
390 LOCATE9,9:PRINT"Tone Coarse: (       ) "+CHR$(42-(AMOD2)*10)
400 LOCATE5,11:PRINT"Noise Frequency: (       ) "+CHR$(42+(A=0)*10)
410 LOCATE7,13:PRINT"Duration Fine: (       ) *"
420 LOCATE5,15:PRINT"Duration Coarse: (       ) *"
430 LOCATE6,17:PRINT"Envelope Shape: (       ) *"
440 LOCATE 3,19:PRINT"KEY COMMANDS:"
450 LOCATE 0,20:PRINT"SPACE = PLAY SOUND"
460 LOCATE 2,21:PRINT"ESC = STOP SOUND"
470 LOCATE 4,22:PRINT"R = RANDOMIZE SOUND"
480 LOCATE 4,23:PRINT"S = SAVE & QUIT";:RETURN
490 IFA=2THENLOCATE24,3:PRINT"BOTH ";
500 IFA=1THENLOCATE24,3:PRINT"NOISE";
510 IFA=0THENLOCATE24,3:PRINT"TONE ";
520 RETURN
530 LOCATE24,5:PRINTB:RETURN
540 LOCATE24,7:PRINTSTR$(C)+"  ":RETURN
550 LOCATE24,9:PRINTD:RETURN
560 LOCATE24,11:PRINTE:RETURN
570 LOCATE24,13:PRINTSTR$(F)+"  ":RETURN
580 LOCATE24,15:PRINTSTR$(G)+"  ":RETURN
590 LOCATE24,17:PRINTH
600 IFH<4THENLOCATE34,17:PRINT"\_____";
610 IFH>3ANDH<8THENLOCATE34,17:PRINT"/_____";
620 IFH=8THENLOCATE34,17:PRINT"\\\\\\";
630 IFH=9THENLOCATE34,17:PRINT"\_____";
640 IFH=10THENLOCATE34,17:PRINT"\/\/\/";
650 IFH=11THENLOCATE34,17:PRINT"\-----";
660 IFH=12THENLOCATE34,17:PRINT"//////";
670 IFH=13THENLOCATE34,17:PRINT"/-----";
680 IFH=14THENLOCATE34,17:PRINT"/\/\/\";
690 IFH=15THENLOCATE34,17:PRINT"/_____";
700 RETURN
Login or register to post comments