SoundGram

This is more a toy for kids to experience sound and music creation. Below is the source code:

DIM KEY$(200)
DIM DUD$(200)
SCREEN 0
beg1:
VIEW PRINT 1 TO 21
CLS
CA = 0
EXI = 0
C = 0
COLOR 1, 11
PRINT "A-Z []-[<-]ERASE [->]PLAY [ESC]SYS 0/1>"
COLOR 15, 5
PRINT "------------SOUNDKEY V1.0------------->"
COLOR 0, 14
LOCATE 18, 1
PRINT "------DEVELOPED BY PAGE TELEGRAM------>"
LOCATE 19, 1
PRINT "             PAGETELEGRAM.COM // 12/18>"
tempo = 2
LOCATE 19, 1: PRINT "                                 "
LOCATE 19, 1: PRINT "Tempo="; tempo

VIEW PRINT 4 TO 17
COLOR 7, 0


BEG:
DO
    R = RND * 14 + 1
    SELECT CASE LCASE$(INKEY$)
        CASE "0":
            IF tempo > 1 THEN tempo = tempo - .5
            LOCATE 20, 1: PRINT "                                 "
            LOCATE 20, 1: PRINT "Tempo="; tempo
            GOTO BEG:
            REM         COLOR 7, 0
            REM      PRINT
            REM   INPUT "FILE NAME?", FIL$

            REM IF FIL$ = "" THEN FIL$ = "DEFAULT.SKA"
            REM IF LEN(FIL$) < 3 THEN FIL$ = FIL$ + "--"
            REM IF MID$(FIL$, LEN(FIL$) - 3, 3) <> "SKA" THEN FIL$ = FIL$ + ".SKA"
            'SLEEP
            'SYSTEM
            REM PRINT

            REM OPEN FIL$ FOR OUTPUT AS #1

            REM FOR I = 1 TO C
            REM    PRINT #1, KEY$(I)
            REM NEXT I
            REM   CLOSE #1
            REM COLOR 15, 4
            REM  PRINT "FILE "; FIL$; " SAVED"
            REM  COLOR 7, 0

            REM   BEEP
        CASE "1":
            IF tempo < 9 THEN tempo = tempo + .5
            LOCATE 20, 1: PRINT "                                 "
            LOCATE 20, 1: PRINT "Tempo="; tempo
            GOTO BEG:
            REM  COLOR 7, 0
            REM PRINT
            REM            SHELL "DIR/B *.SKA > LIST.DAT"
            REM          OPEN "LIST.DAT" FOR INPUT AS #2
            REM        PRINT
            REM      DO
            REM  IF NOT (EOF(2)) THEN INPUT #2, OT$

            REM    PRINT OT$;
            REM    COLOR 0, 15
            REM    PRINT " / ";
            REM     COLOR 7, 0
            REM    CA = CA + LEN(OT$) + 3
            REM IF CA >= 20 THEN PRINT: CA = 0
            REM LOOP UNTIL EOF(2)
            REM   CLOSE #2
            REM  PRINT
            REM  T1:
            REM   INPUT "LOAD FILE?", LOD$
            REM IF LEN(LOD$) <= 3 THEN GOTO T1:
            REM IF MID$(LOD$, LEN(LOD$) - 3, 3) <> "SKA" THEN LOD$ = LOD$ + ".SKA"
            REM  IF LOD$ = "" THEN GOTO BEG1:
            REM     PRINT LOD$: SLEEP
            REM   OPEN LOD$ FOR INPUT AS #3
            REM   I = 0
            REM   PRINT
            REM  DO
            REM     I = I + 1
            REM   IF NOT (EOF(3)) THEN INPUT #3, DUD$(I)


            REM  IF DUD$(I) = "150" THEN DD$ = "A"
            REM   IF DUD$(I) = "200" THEN DD$ = "B"
            REM  IF DUD$(I) = "250" THEN DD$ = "C"
            REM IF DUD$(I) = "300" THEN DD$ = "D"
            REM  IF DUD$(I) = "350" THEN DD$ = "E"
            REM IF DUD$(I) = "400" THEN DD$ = "F"
            REM IF DUD$(I) = "450" THEN DD$ = "G"
            REM IF DUD$(I) = "500" THEN DD$ = "H"
            REM        IF DUD$(I) = "550" THEN DD$ = "I"
            REM        IF DUD$(I) = "600" THEN DD$ = "J"
            REM      IF DUD$(I) = "650" THEN DD$ = "K"
            REM   REM        IF DUD$(I) = "700" THEN DD$ = "L"
            ' IF DUD$(I) = "750" THEN DD$ = "M"
            ' IF DUD$(I) = "800" THEN DD$ = "N"
            ' IF DUD$(I) = "850" THEN DD$ = "O"
            ' IF DUD$(I) = "900" THEN DD$ = "P"
            ' IF DUD$(I) = "950" THEN DD$ = "Q"
            ' IF DUD$(I) = "1000" THEN DD$ = "R"
            ' IF DUD$(I) = "1050" THEN DD$ = "S"
            ' IF DUD$(I) = "1100" THEN DD$ = "T"
            ' IF DUD$(I) = "1150" THEN DD$ = "U"
            ' IF DUD$(I) = "1200" THEN DD$ = "V"
            ' IF DUD$(I) = "1250" THEN DD$ = "W"
            ' IF DUD$(I) = "1300" THEN DD$ = "X"
            ' IF DUD$(I) = "1350" THEN DD$ = "Y"
            'IF DUD$(I) = "1400" THEN DD$ = "Z"


            'IF DUD$(I) = "6000" THEN
            '   DD$ = "-*-": COLOR 0, 15: CA = CA + 3

            'ELSE
            '   COLOR 1 + (RND * 14), 0
            ' END IF
            '   CA = CA + 1
            '    IF CA >= 20 THEN
            '      PRINT
            ' IF DD$ <> "-*-" THEN COLOR 7, 0

            '        CA = 0
            '   END IF
            '  PRINT DD$; " ";
            '  COLOR 7, 0
            ' KEY$(I) = DUD$(I)
            ' LOOP UNTIL EOF(3)
            '     C = I
            '     CA = 0
            '     CLOSE #3
            '     BEEP
            '     COLOR 7, 0
            '     CA = 1
            '     PRINT
            '     K = 1
            '    GOTO BEG:
        CASE "a": SOUND 150, 1: PRINT "A ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "150": T = TIM
        CASE "b": SOUND 200, 1: PRINT "B ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "200": T = TIM
        CASE "c": SOUND 250, 1: PRINT "C ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "250": T = TIM
        CASE "d": SOUND 300, 1: PRINT "D ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "300": T = TIM
        CASE "e": SOUND 350, 1: PRINT "E ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "350": T = TIM
        CASE "f": SOUND 400, 1: PRINT "F ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "400": T = TIM
        CASE "g": SOUND 450, 1: PRINT "G ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "450": T = TIM
        CASE "h": SOUND 500, 1: PRINT "H ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "500": T = TIM
        CASE "i": SOUND 550, 1: PRINT "I ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "550": T = TIM
        CASE "j": SOUND 600, 1: PRINT "J ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "600": T = TIM
        CASE "k": SOUND 650, 1: PRINT "K ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "650": T = TIM
        CASE "l": SOUND 700, 1: PRINT "L ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "700": T = TIM
        CASE "m": SOUND 750, 1: PRINT "M ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "750": T = TIM
        CASE "n": SOUND 800, 1: PRINT "N ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "800": T = TIM
        CASE "o": SOUND 850, 1: PRINT "O ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "850": T = TIM
        CASE "p": SOUND 900, 1: PRINT "P ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "900": T = TIM
        CASE "q": SOUND 950, 1: PRINT "Q ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "950": T = TIM
        CASE "r": SOUND 1000, 1: PRINT "R ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1000": T = TIM
        CASE "s": SOUND 1050, 1: PRINT "S ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1050": T = TIM
        CASE "t": SOUND 1100, 1: PRINT "T ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1100": T = TIM
        CASE "u": SOUND 1150, 1: PRINT "U ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1150": T = TIM
        CASE "v": SOUND 1200, 1: PRINT "V ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1200": T = TIM
        CASE "w": SOUND 1250, 1: PRINT "W ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1250": T = TIM
        CASE "x": SOUND 1300, 1: PRINT "X ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1300": T = TIM
        CASE "y": SOUND 1350, 1: PRINT "Y ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1350": T = TIM
        CASE "z": SOUND 1400, 1: PRINT "Z ";: COLOR R: CA = CA + 1: C = C + 1: KEY$(C) = "1400": T = TIM
        CASE CHR$(8): C = 1: GOTO beg1:
        CASE CHR$(32): COLOR 0, 15: PRINT "-*-";: COLOR 7, 0: PRINT " ";: CA = CA + 3: C = C + 1: KEY$(C) = "6000"
        CASE CHR$(27): EXI = 1
        CASE CHR$(13): K = 1: IF K = 1 THEN GOTO PLY:
    END SELECT
    TIM = VAL(MID$(TIME$, (LEN(TIME$) - 2), 2))
    'IF C >= 2 THEN IF T >= TIM THEN T = TIM: COLOR 0, 15: PRINT "-*-"; : COLOR 7, 0: PRINT " "; : CA = CA + 3: C = C + 1: KEY$(C) = "6000"
    IF C >= 199 THEN PRINT: PRINT "MEMORY LIMIT REACHED": BEEP: C = C - 1
    IF CA >= 20 THEN PRINT: CA = 0
LOOP UNTIL EXI = 1

PLY:
K = 0
FOR I = 1 TO C
    SOUND (VAL(KEY$(I))), 1
    SOUND 60, 2
NEXT I
GOTO BEG: