-
Notifications
You must be signed in to change notification settings - Fork 0
/
MELODY.EL
1544 lines (1266 loc) · 34.5 KB
/
MELODY.EL
1
#OUTPUT PLAYMAKER' ËEYS:' ----' ÕP ARROW = ÍOVE TO PREVIOUS VOICE' ÄOWN ARROW = ÍOVE TO NEXT VOICE' ÌEFT ARROW = ÍOVE LEFT WITHIN CURRRENT VOICE STRING' ÒIGHT ARROW = ÍOVE RIGHT WITHIN CURRENT VOICE STRING' ÉÎÓÔ/ÄÅÌ = ÄELETE CHAR IN CURRENT VOICE STRING' ÅÓÃ,Ê = ÍOVE TO START OF CURRENT VOICE STRING' ÅÓÃ,Ë = ÍOVE TO END OF CURRENT VOICE STRING' ÃÔÒÌ+× = ÍOVE FORWARD ONE WORD IN CURRENT VOICE STRING' ÃÔÒÌ+Õ = ÍOVE BACK ONE WORD IN CURRENT VOICE STRING' < = ÓHOW PREVIOUS SONG CHUNK' > = ÓHOW NEXT SONG CHUNK' - = ÄECREASE TEMPO' + = ÉNCREASE TEMPO' ÍÅÇÁ+Ñ = ÑUIT PROGRAM / ÅXIT ÅNV ÅDITOR' Æ1 = ÌOAD' Æ3 = ÓAVE' Æ7 = ÅNVELOPE EDITOR' Æ8 = ÆILTER EDITOR' Æ9/ÃÔÒÌ-Ð = ÃHUNK SEQUENCERTRAP RUNSTOP¯TRAPPER.DECLARATIONS'------------#DECLARE CHUNK¯IDX = 0#DECLARE CHUNK¯CNT = 0#DEFINE CHUNK¯MAX = 50#DECLARE VIDX, IDX#DECLARE CURSOR¯X = 0#DECLARE CURSOR¯Y = 0#DECLARE V$(5,CHUNK¯MAX)#DECLARE KEY$#DECLARE VALID$="CDEFGAB0123456789 #$.HIQRSWOTUXMPL"#DECLARE VAL$#DECLARE TMPO% = 12#DECLARE ESC¯FLAG% = 0#STRUCT ÅÎÖÔÙÐÅ NAME$, ATTACK, DECAY, SUSTAIN, RELEASE, WAVEFORM, PWÅÎÖÔÙÐÅ ENVS(9) = [ _ [ "ÐIANO", 0, 9, 0, 0, 2, 1536 ], _ [ "ÁCCORDION", 12, 0, 12, 0, 1, 0 ], _ [ "ÃALLIOPE", 0, 0, 15, 0, 0, 0 ], _ [ "ÄRUM", 0, 5, 5, 0, 3, 0 ], _ [ "ÆLUTE", 9, 4, 4, 0, 0, 0 ], _ [ "ÇUITAR", 0, 9, 2, 1, 1, 0 ], _ [ "ÈARPSICRD", 0, 9, 0, 0, 2, 512 ], _ [ "ÏRGAN", 0, 9, 9, 0, 2, 2048 ], _ [ "ÔRUMPET", 8, 9, 4, 1, 2, 512 ], _ [ "ØYLOPHONE", 0, 9, 0, 0, 0, 0 ] _]#DEFINE ÄÉÒ¯ÎÏÎÅ = 0#DEFINE ÄÉÒ¯ÕÐ = 1#DEFINE ÄÉÒ¯ÄÏ×Î = 2#DEFINE ÄÉÒ¯ÏÓà = 3#DECLARE DIR¯NAME$(3)DIR¯NAME$(0) = "ÎÏÎÅ"DIR¯NAME$(1) = "ÕÐ"DIR¯NAME$(2) = "ÄÏ×Î"DIR¯NAME$(3) = "ÏÓÃ"#DEFINE ƯÏÆÆ = 0#DEFINE ƯÏÎ = 1#STRUCT ÆÉÌÔÔÙÐÅ NAME$, FREQ, LP, BP, HP, RES, DIR, MIN, SWEEPÆÉÌÔÔÙÐÅ FILT(10) = [ _ [ "LOWP¯UP", 1000, ƯÏÎ, ƯÏÆÆ, ƯÏÆÆ, 15, ÄÉÒ¯ÕÐ, 100, 10 ], _ [ "LOWP¯DOWN", 1000, ƯÏÎ, ƯÏÆÆ, ƯÏÆÆ, 15, ÄÉÒ¯ÄÏ×Î, 100, 10 ], _ [ "LOWP¯OSC", 1000, ƯÏÎ, ƯÏÆÆ, ƯÏÆÆ, 15, ÄÉÒ¯ÏÓÃ, 100, 10 ], __ [ "BANDP¯UP", 1000, ƯÏÆÆ, ƯÏÎ, ƯÏÆÆ, 15, ÄÉÒ¯ÕÐ, 100, 10 ], _ [ "BANDP¯DOWN", 1000, ƯÏÆÆ, ƯÏÎ, ƯÏÆÆ, 15, ÄÉÒ¯ÄÏ×Î, 100, 10 ], _ [ "BANDP¯OSC", 1000, ƯÏÆÆ, ƯÏÎ, ƯÏÆÆ, 15, ÄÉÒ¯ÏÓÃ, 100, 10 ], __ [ "HIGHP¯UP", 1000, ƯÏÆÆ, ƯÏÆÆ, ƯÏÎ, 15, ÄÉÒ¯ÕÐ, 100, 10 ], _ [ "HIGHP¯DOWN", 1000, ƯÏÆÆ, ƯÏÆÆ, ƯÏÎ, 15, ÄÉÒ¯ÄÏ×Î, 100, 10 ], _ [ "HIGHP¯OSC", 1000, ƯÏÆÆ, ƯÏÆÆ, ƯÏÎ, 15, ÄÉÒ¯ÏÓÃ, 100, 10 ], __ [ "SPARE¯1", 0, ƯÏÆÆ, ƯÏÆÆ, ƯÏÆÆ, 0, ÄÉÒ¯ÎÏÎÅ, 0, 0 ], _ [ "SPARE¯2", 0, ƯÏÆÆ, ƯÏÆÆ, ƯÏÆÆ, 0, ÄÉÒ¯ÎÏÎÅ, 0, 0 ], __]#DECLARE SEQ¯CHUNK(200), SEQ¯EXTRA(200)#DECLARE ECHO¯M, ECHO¯B, ECHO¯SZ = .05, CHUNK¯RPT, ECHO¯DELAY#DECLARE V1$, V2$, V3$, V4$, V5$, V6$#DECLARE TMP#DECLARE SSCOL, S, SEQ¯OFFS#DEFINE ÏЯÃÏÐÙ = 0#DEFINE ÏЯÍÉØ = 1#DEFINE ÏЯÓ×ÁÐ = 2#DEFINE ÏЯÆÉÌÌ = 3#DEFINE ÓÃÒÎÐÔÒÌÓ = $D060#DEFINE ÓÃÒÎÐÔÒÍÓ = $D061#DEFINE ÓÃÒÎÐÔÒÂÎË = $D062.CMDS#DEFINE ÃÍįÔÅÍÐÏ = -1#DEFINE ÃÍįÆÉÌÔÅÒ = -2#DEFINE ÃÍįÌÏÏÐ = -3#DEFINE ÃÍįÅÃÈϯÍ1 = -4 ' ECHO MELODY: VOICE 1 ON VOICE 4#DEFINE ÃÍįÅÃÈϯÍ2 = -5 ' ECHO MELODY: VOICE 1 ON VOICE 2 + 4 + 5#DEFINE ÃÍįÅÃÈϯ = -6 ' ECHO BASS: VOICE 3 ON VOICE 6#DEFINE ÃÍįÅÃÈϯÏÆÆ = -7#DEFINE ÃÍįÅÃÈϯÓÚ = -8#DEFINE ÃÍįÖÏÌ = -9#DEFINE ÃÍįÄÅÌÁÙ = -10#DEFINE ÃÍįÍÁØ = 11#DECLARE SEQ¯CMDNAME$(10)SEQ¯CMDNAME$(1) = "ÔÅÍÐÏ"SEQ¯CMDNAME$(2) = "ÆÉÌÔÅÒ"SEQ¯CMDNAME$(3) = "ÌÏÏÐ"SEQ¯CMDNAME$(4) = "ÅÃÈϯÍ1"SEQ¯CMDNAME$(5) = "ÅÃÈϯÍ2"SEQ¯CMDNAME$(6) = "ÅÃÈϯÂ"SEQ¯CMDNAME$(7) = "ÅÃÈϯÏÆÆ"SEQ¯CMDNAME$(8) = "ÅÃÈϯÓÚ"SEQ¯CMDNAME$(9) = "ÖÏÌ"SEQ¯CMDNAME$(10) = "ÄÅÌÁÙ"#DECLARE SEQCNT, SEQPTR#DECLARE ROW, COL, SROW, SCOL, A$, V, MAXV, V$#STRUCT ËÅÙ¯ÔÙÐÅ IN$, OUT$ËÅÙ¯ÔÙÐÅ KEYS(11) = [ _ [ "A", "C", ], _ [ "W", "#C", ], _ [ "S", "D", ], _ [ "E", "#D", ], _ [ "D", "E", ], _ [ "F", "F", ], _ [ "T", "#F", ], _ [ "G", "G", ], _ [ "Y", "#G", ], _ [ "H", "A", ], _ [ "U", "#A", ], _ [ "J", "B", ] _]#DECLARE PSTR$, K, DELTA#DECLARE WNAME$(4)WNAME$(0) = "ÔÒÉ"WNAME$(1) = "ÓÁ×"WNAME$(2) = "ÐÕÌÓÅ"WNAME$(3) = "ÎÏÉÓÅ"WNAME$(4) = "ÒÉÎÇ"#DECLARE FILT¯STATE¯NAME$(2)FILT¯STATE¯NAME$(0) = "ÏÆÆ"FILT¯STATE¯NAME$(1) = "ÏÎ"#DECLARE FPRESET = 1#DECLARE FSCOL = 0, FSROW = 0, FFOCUS = 0, FSEL = -1#DECLARE OCT = 5#DECLARE CURR¯FREQ, CURR¯DIR#DECLARE HANDLED#DECLARE PLYPTR = -1, PLYFLAG.DURATION'--------#DEFINE ÄÎÁÍÅ = 0#DEFINE ÄÃÈÁÒ = 1#DEFINE ÄËÅÙ = 2#DEFINE į×ÈÏÌÅ = 0#DEFINE įÈÁÌÆ = 1#DEFINE įÑÕÁÒÔÅÒ = 2#DEFINE įÅÉÇÈÔÈ = 3#DEFINE įÓÉØÔÅÅÎÔÈ = 4#DECLARE SDUR = 2#DECLARE DUR$(5,2)DUR$(į×ÈÏÌÅ, ÄÎÁÍÅ) = "WHOLE"DUR$(į×ÈÏÌÅ, ÄÃÈÁÒ) = "W"DUR$(į×ÈÏÌÅ, ÄËÅÙ) = "1"DUR$(įÈÁÌÆ, ÄÎÁÍÅ) = "HALF"DUR$(įÈÁÌÆ, ÄÃÈÁÒ) = "H"DUR$(įÈÁÌÆ, ÄËÅÙ) = "2"DUR$(įÑÕÁÒÔÅÒ, ÄÎÁÍÅ) = "QUARTER"DUR$(įÑÕÁÒÔÅÒ, ÄÃÈÁÒ) = "Q"DUR$(įÑÕÁÒÔÅÒ, ÄËÅÙ) = "3"DUR$(įÅÉÇÈÔÈ, ÄÎÁÍÅ) = "EIGHTH"DUR$(įÅÉÇÈÔÈ, ÄÃÈÁÒ) = "I"DUR$(įÅÉÇÈÔÈ, ÄËÅÙ) = "4"DUR$(įÓÉØÔÅÅÎÔÈ, ÄÎÁÍÅ) = "SIXTEENTH"DUR$(įÓÉØÔÅÅÎÔÈ, ÄÃÈÁÒ) = "S"DUR$(įÓÉØÔÅÅÎÔÈ, ÄËÅÙ) = "5"#DECLARE CLIP$, ALT¯KEY, LIMIT, RET%, Y, CP$(6).KEYS'----#DEFINE ËÅÙ¯ÕÐ = "‘"#DEFINE ËÅÙ¯ÄÏ×Î = ""#DEFINE ËÅÙ¯ÌÅÆÔ = ""#DEFINE ËÅÙ¯ÒÉÇÈÔ = ""#DEFINE ËÅÙ¯ÓÐÁÃÅ = " "#DEFINE ËÅÙ¯ÄÅÌ = ""#DEFINE ËÅÙ¯ÃÔÒÌ¯× = ""#DEFINE ËÅÙ¯ÃÔÒÌ¯Õ = ""#DEFINE ËÅÙ¯ÍÅÇÁ¯Ñ = "«"#DEFINE ËÅÙ¯Æ1 = "…"#DEFINE ËÅÙ¯Æ3 = "†"#DEFINE ËÅÙ¯Æ4 = "Š"#DEFINE ËÅÙ¯Æ7 = "ˆ"#DEFINE ËÅÙ¯Æ8 = "Œ"#DEFINE ËÅÙ¯Æ9 = CHR$(16)#DEFINE ËÅÙ¯ÒÅÔÕÒÎ = CHR$(13)#DEFINE ËÅÙ¯ÅÓÃÁÐÅ = CHR$(27)#DEFINE ËÅÙ¯ÓÈÉÆÔ¯ÒÅÔÕÒÎ = CHR$(141)#DEFINE ËÅÙ¯ÓÈÉÆÔ¯ÐÌÕÓ = "Û"#DEFINE ËÅÙ¯ÓÈÉÆÔ¯ÍÉÎÕÓ = "Ý"#DEFINE ËÅÙ¯ÒÅÖ¯ÏÎ = ""#DEFINE ËÅÙ¯ÒÅÖ¯ÏÆÆ = "’"#DEFINE ËÅÙ¯ÔÁ = CHR$(9)#DEFINE ËÅÙ¯ÈÏÍÅ = ""#DEFINE ËÅÙ¯ÃÌÒ = "“"#DEFINE ËÅÙ¯ÌÏ×ÅÒÃÁÓÅ = CHR$(14)#DEFINE ËÅÙ¯ÕÐÐÅÒÃÁÓÅ = CHR$(142)#DEFINE ËÅÙ¯ÂÅÅÐ = CHR$(7)#DEFINE ËÅÙ¯ÉÎÓÔ = "”"#DEFINE ËÅÙ¯ÄÅÌ = "".INIT'----PRINT "“";ËÅÙ¯ÌÏ×ÅÒÃÁÓÅ;ËÅÙ¯ÅÓÃÁÐÅ;"5";PLAY : PLAY ""BACKGROUND 0 : BORDER 0COLOR 5.MAIN'---- KEY OFF GOSUB DRAW¯EDITOR¯SCREEN GOSUB USER¯INPUT GOTO MAIN.DRAW¯EDITOR¯SCREEN'------------------ CURSOR 0,0:PRINT "“PLAYMAKER V0.5 - BY GURCE ISIKYILDIZ" PRINT "---------" PRINT "<: PREV CHUNK, >: NEXT CHUNK, -/+ TEMPO, Æ7=ENV EDITOR, Æ9/ÃÔÒÌ-Ð=SEQ EDITOR" PRINT "ÒÔÎ: PLAY CURR VOICE, ÓÈÆÔ+ÒÔÎ: PLAY ALL VOICE, Æ1=LOAD, Æ3=SAVE, ÍÅÇÁ+Ñ=QUIT" PRINT "ÁÌÔ-Ø/Ã/Ö: ROW CUT/COPY/PASTE, ÅÓÃ-ÅÓÃ: STOP MUSIC, ÁÌÔ-ÒÔÎ: PLAY FROM CURSOR" PRINT GOSUB DRAW¯CURRENT¯CHUNK RETURN.DRAW¯CURRENT¯CHUNK'------------------ PRINT "TEMPO: "; TMPO% PRINT "CHUNK¯IDX: "; CHUNK¯IDX FOR VIDX=0 TO 5 IF CURSOR¯Y <> VIDX THEN BEGIN CURSOR 0,9+VIDX*2:PRINT CHR$(27);"Q";"V";VIDX+1;": ";V$(VIDX,CHUNK¯IDX); BEND:ELSE BEGIN CURSOR 0,9+VIDX*2:PRINT CHR$(27);"Q";"V";VIDX+1;": "; FOR IDX=1 TO LEN(V$(VIDX,CHUNK¯IDX)) IF CURSOR¯X = IDX-1 THEN BEGIN PRINT "";MID$(V$(VIDX,CHUNK¯IDX),IDX,1);"’"; BEND:ELSE BEGIN PRINT MID$(V$(VIDX,CHUNK¯IDX),IDX,1); BEND NEXT IDX IF LEN(V$(VIDX,CHUNK¯IDX)) = 0 OR CURSOR¯X=LEN(V$(VIDX,CHUNK¯IDX)) THEN PRINT " ’"; BEND NEXT VIDX RETURN.CHECK¯VALID¯KEY'--------------- FOR IDX=1 TO LEN(VALID$) VAL$=MID$(VALID$,IDX,1) IF KEY$= VAL$ THEN BEGIN IF CURSOR¯X < LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN BEGIN V$(CURSOR¯Y,CHUNK¯IDX) = LEFT$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X) _ + VAL$ + MID$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X+1) CURSOR¯X=CURSOR¯X+1 RETURN BEND V$(CURSOR¯Y,CHUNK¯IDX)=V$(CURSOR¯Y,CHUNK¯IDX)+VAL$ CURSOR¯X=CURSOR¯X+1 RETURN BEND NEXT IDX RETURN.FORWARD¯WORD'------------ IF CURSOR¯X = LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN RETURN DO WHILE MID$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X+1,1) <> " " CURSOR¯X=CURSOR¯X+1 IF CURSOR¯X = LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN RETURN LOOP DO WHILE MID$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X+1,1) = " " CURSOR¯X=CURSOR¯X+1 IF CURSOR¯X = LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN RETURN LOOP RETURN.PREVIOUS¯WORD'------------- IF CURSOR¯X = 0 THEN RETURN IF CURSOR¯X = 1 THEN CURSOR¯X = 0: RETURN CURSOR¯X = CURSOR¯X - 1 DO WHILE MID$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X+1,1) = " " CURSOR¯X=CURSOR¯X-1 IF CURSOR¯X = 0 THEN RETURN LOOP DO WHILE MID$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X+1,1) <> " " CURSOR¯X=CURSOR¯X-1 IF CURSOR¯X = 0 THEN RETURN LOOP CURSOR¯X=CURSOR¯X+1 RETURN.SET¯ALL¯ENV'----------- FOR ROW = 0 TO 9 GOSUB SET¯ENV NEXT ROW RETURN.LOAD'---- INPUT "LOAD NAME: ";KEY$ IF KEY$="" THEN RETURN DOPEN #2,(KEY$),R,U8 ' LOAD MELODY CHUNKS ' ------------------ INPUT #2, CHUNK¯CNT FOR CHUNK¯IDX = 0 TO CHUNK¯CNT - 1 FOR VIDX=0 TO 5 INPUT #2,V$(VIDX, CHUNK¯IDX) NEXT VIDX NEXT CHUNK¯IDX INPUT #2,TMPO% ' LOAD ENVELOPES ' -------------- FOR ROW = 0 TO 9 INPUT #2, ENVS¯NAME$(ROW) INPUT #2, ENVS¯ATTACK(ROW) INPUT #2, ENVS¯DECAY(ROW) INPUT #2, ENVS¯SUSTAIN(ROW) INPUT #2, ENVS¯RELEASE(ROW) INPUT #2, ENVS¯WAVEFORM(ROW) INPUT #2, ENVS¯PW(ROW) GOSUB SET¯ENV NEXT ROW PRINT ' LOAD FILTER PRESETS ' ------------------- FOR ROW = 0 TO 10 INPUT #2, FILT¯NAME$(ROW) INPUT #2, FILT¯FREQ(ROW) INPUT #2, FILT¯LP(ROW) INPUT #2, FILT¯BP(ROW) INPUT #2, FILT¯HP(ROW) INPUT #2, FILT¯RES(ROW) INPUT #2, FILT¯DIR(ROW) INPUT #2, FILT¯MIN(ROW) INPUT #2, FILT¯SWEEP(ROW) NEXT ROW ' LOAD SEQUENCE ' ------------- SEQCNT = 0 INPUT #2, SEQCNT ROW = 0 DO WHILE ROW < SEQCNT INPUT #2, SEQ¯CHUNK(ROW) INPUT #2, SEQ¯EXTRA(ROW) ROW = ROW + 1 LOOP DCLOSE #2 CHUNK¯IDX = 0 RETURN.GET¯CHUNK¯CNT'------------- CHUNK¯CNT = 0 FOR K = 0 TO CHUNK¯MAX IF V$(0,K)<>"" OR V$(1,K)<>"" OR V$(2,K)<>"" OR V$(3,K)<>"" OR V$(4,K)<>"" OR V$(5,K)<>"" THEN BEGIN CHUNK¯CNT = K + 1 BEND NEXT K RETURN.SAVE'---- INPUT "SAVE NAME: ";KEY$ IF KEY$="" THEN RETURN DELETE (KEY$) DOPEN #2,(KEY$),W,U8 TMP = CHUNK¯IDX ' SAVE MELODY CHUNKS ' ------------------ GOSUB GET¯CHUNK¯CNT PRINT #2, CHUNK¯CNT FOR CHUNK¯IDX = 0 TO CHUNK¯CNT - 1 FOR VIDX=0 TO 5 PRINT #2,V$(VIDX, CHUNK¯IDX) NEXT VIDX NEXT CHUNK¯IDX PRINT #2,TMPO% ' SAVE ENVELOPES ' -------------- FOR ROW = 0 TO 9 PRINT #2, ENVS¯NAME$(ROW) PRINT #2, ENVS¯ATTACK(ROW) PRINT #2, ENVS¯DECAY(ROW) PRINT #2, ENVS¯SUSTAIN(ROW) PRINT #2, ENVS¯RELEASE(ROW) PRINT #2, ENVS¯WAVEFORM(ROW) PRINT #2, ENVS¯PW(ROW) NEXT ROW ' SAVE FILTER PRESETS ' ------------------- FOR ROW = 0 TO 10 PRINT #2, FILT¯NAME$(ROW) PRINT #2, FILT¯FREQ(ROW) PRINT #2, FILT¯LP(ROW) PRINT #2, FILT¯BP(ROW) PRINT #2, FILT¯HP(ROW) PRINT #2, FILT¯RES(ROW) PRINT #2, FILT¯DIR(ROW) PRINT #2, FILT¯MIN(ROW) PRINT #2, FILT¯SWEEP(ROW) NEXT ROW ' SAVE SEQUENCE ' ------------- PRINT #2, SEQCNT ROW = 0 DO WHILE ROW < SEQCNT PRINT #2, SEQ¯CHUNK(ROW) PRINT #2, SEQ¯EXTRA(ROW) ROW = ROW + 1 LOOP DCLOSE #2 CHUNK¯IDX = TMP RETURN.SAVE¯AS¯TEXT'------------ INPUT "SAVE (AS TEXT) NAME: ";KEY$ IF KEY$="" THEN RETURN DELETE (KEY$) DOPEN #2,(KEY$),W,U8 FOR CHUNK¯IDX = 0 TO CHUNK¯MAX FOR VIDX=0 TO 5 PRINT #2, "V";CHR$(49+VIDX);"$(";STR$(CHUNK¯IDX);")="; PRINT #2, CHR$(34);V$(VIDX, CHUNK¯IDX);CHR$(34) NEXT VIDX PRINT #2, "" NEXT CHUNK¯IDX DCLOSE #2 CHUNK¯IDX = 0 RETURN.USER¯INPUT'---------- ' GETKEY KEY$ GOSUB READ¯KEY¯LOOP KEY$ = A$ GOSUB CHECK¯ALT¯KEY¯INPUTS ' DOWN ARROW? IF KEY$ = ËÅÙ¯ÄÏ×Î AND CURSOR¯Y<5 THEN BEGIN CURSOR¯Y = CURSOR¯Y + 1 IF CURSOR¯X > LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN CURSOR¯X = _ LEN(V$(CURSOR¯Y,CHUNK¯IDX)) BEND ' UP ARROW? IF KEY$ = ËÅÙ¯ÕÐ AND CURSOR¯Y>0 THEN BEGIN CURSOR¯Y = CURSOR¯Y - 1 IF CURSOR¯X > LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN _ CURSOR¯X = LEN(V$(CURSOR¯Y,CHUNK¯IDX)) BEND ' RIGHT ARROW? IF KEY$ = ËÅÙ¯ÒÉÇÈÔ AND CURSOR¯X < LEN(V$(CURSOR¯Y,CHUNK¯IDX)) THEN BEGIN CURSOR¯X=CURSOR¯X+1 BEND ' LEFT ARROW? IF KEY$ = ËÅÙ¯ÌÅÆÔ AND CURSOR¯X > 0 THEN CURSOR¯X=CURSOR¯X-1 ' BACKSPACE (INST/DEL)? IF KEY$ = ËÅÙ¯ÄÅÌ AND CURSOR¯X > 0 THEN BEGIN V$(CURSOR¯Y,CHUNK¯IDX)=LEFT$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X-1) _ + MID$(V$(CURSOR¯Y,CHUNK¯IDX),CURSOR¯X+1) CURSOR¯X=CURSOR¯X-1 BEND IF ESC¯FLAG% THEN BEGIN ESC¯FLAG%=0 IF KEY$ = "J" THEN BEGIN:CURSOR¯X=0:BEND IF KEY$ = "K" THEN BEGIN:CURSOR¯X=LEN(V$(CURSOR¯Y,CHUNK¯IDX)):BEND IF KEY$=ËÅÙ¯ÅÓÃÁÐÅ THEN GOSUB STOP¯ALL¯MUSIC KEY$="" BEND IF KEY$ = ËÅÙ¯ÅÓÃÁÐÅ THEN ESC¯FLAG%=ABS(ESC¯FLAG%-1) ' CTRL-W = FORWARD ONE WORD IF KEY$ = ËÅÙ¯ÃÔÒÌ¯× THEN GOSUB FORWARD¯WORD ' CTRL-U = BACK ONE WORD IF KEY$ = ËÅÙ¯ÃÔÒÌ¯Õ THEN GOSUB PREVIOUS¯WORD ' < / > = PREVIOUS/NEXT CHUNK IF KEY$ = "<" AND CHUNK¯IDX>0 THEN BEGIN CHUNK¯IDX=CHUNK¯IDX-1 CURSOR¯X=0 BEND IF KEY$ = ">" AND CHUNK¯IDX<CHUNK¯MAX THEN BEGIN CHUNK¯IDX=CHUNK¯IDX+1 CURSOR¯X=0 BEND ' +/- = TEMPO CHANGE IF KEY$="-" THEN TMPO%=TMPO%-1 IF KEY$="+" THEN TMPO%=TMPO%+1 ' MEGA-Q = EXIT IF KEY$ = ËÅÙ¯ÍÅÇÁ¯Ñ THEN BEGIN PRINT "ARE YOU SURE? (Y/N)" GET KEY A$ IF A$="Y" THEN KEY ON:END BEND IF KEY$ = ËÅÙ¯Æ1 THEN GOSUB LOAD IF KEY$ = ËÅÙ¯Æ3 THEN GOSUB SAVE IF KEY$ = ËÅÙ¯Æ7 THEN GOSUB ENVELOPE¯EDITOR IF KEY$ = ËÅÙ¯Æ9 THEN GOSUB CHUNK¯SEQUENCER ' Æ4 = SAVE AS TEXT IF KEY$ = ËÅÙ¯Æ4 THEN GOSUB SAVE¯AS¯TEXT ' RETURN=PLAY ROW IF KEY$ = ËÅÙ¯ÒÅÔÕÒÎ THEN TEMPO TMPO% : PLAY V$(CURSOR¯Y,CHUNK¯IDX) ' SHIFT+RETURN=PLAY ALL CHANNELS IF KEY$ = ËÅÙ¯ÓÈÉÆÔ¯ÒÅÔÕÒÎ THEN BEGIN TEMPO TMPO% GOSUB PLAY¯CHUNK¯IDX BEND IF KEY$ = ËÅÙ¯ÉÎÓÔ THEN BEGIN V1$ = V$(CURSOR¯Y, CHUNK¯IDX) V1$ = LEFT$(V1$,CURSOR¯X) + MID$(V1$,CURSOR¯X+2) V$(CURSOR¯Y, CHUNK¯IDX) = V1$ BEND GOSUB CHECK¯VALID¯KEY RETURN.CHECK¯ALT¯KEY¯INPUTS'-------------------- ALT¯KEY = PEEK($D611) AND 16 IF ALT¯KEY = 0 THEN RETURN IF KEY$="X" THEN CLIP$=V$(CURSOR¯Y, CHUNK¯IDX) : V$(CURSOR¯Y, CHUNK¯IDX) = "" IF KEY$="C" THEN CLIP$=V$(CURSOR¯Y, CHUNK¯IDX) IF KEY$="V" THEN V$(CURSOR¯Y, CHUNK¯IDX) = CLIP$ IF KEY$="Ã" THEN GOSUB COPY¯ALL¯VOICES¯TO¯CLIPBOARD IF KEY$="Ö" THEN GOSUB PASTE¯ALL¯VOICES¯FROM¯CLIPBOARD IF KEY$=ËÅÙ¯ÒÅÔÕÒÎ THEN BEGIN V1$ = MID$(V$(CURSOR¯Y, CHUNK¯IDX), CURSOR¯X + 1) TEMPO TMPO% : PLAY V1$ BEND IF KEY$="," THEN DELTA = -1 : GOSUB TRANSPOSE¯OCTAVE IF KEY$="." THEN DELTA = 1 : GOSUB TRANSPOSE¯OCTAVE IF KEY$="I" THEN GOSUB INSERT¯CHUNK KEY$ = "" RETURN.COPY¯ALL¯VOICES¯TO¯CLIPBOARD'---------------------------- FOR Y = 0 TO 5 CP$(Y) = V$(Y, CHUNK¯IDX) NEXT Y RETURN.PASTE¯ALL¯VOICES¯FROM¯CLIPBOARD'------------------------------- FOR Y = 0 TO 5 V$(Y, CHUNK¯IDX) = CP$(Y) NEXT Y RETURN.INSERT¯CHUNK'------------ FOR K = CHUNK¯MAX-1 TO CHUNK¯IDX + 1 STEP -1 FOR Y = 0 TO 5 V$(Y, K) = V$(Y, K-1) NEXT Y NEXT K FOR Y = 0 TO 5 V$(Y, CHUNK¯IDX) = "" NEXT Y ' REPAIR ITEMS IN THE SEQUENCE THAT ARE AFFECTED FOR K = 0 TO 100 IF SEQ¯CHUNK(K) >= CHUNK¯IDX THEN SEQ¯CHUNK(K) = SEQ¯CHUNK(K) + 1 NEXT K RETURN.TRANSPOSE¯OCTAVE'---------------- V1$ = V$(CURSOR¯Y, CHUNK¯IDX) LIMIT = 0 IF DELTA = 1 THEN LIMIT = 6 RET% = 0 GOSUB CAN¯TRANSPOSE¯OCTAVE IF RET% = 0 THEN PRINT ËÅÙ¯ÂÅÅÐ; : RETURN K = 0 DO WHILE K < LEN(V1$) V2$ = MID$(V1$,K+1,1) IF V2$ = "O" AND (K + 1) < LEN(V1$) THEN BEGIN V2$ = STR$(VAL(MID$(V1$,K+2,1)) + DELTA) V2$ = MID$(V2$,2) V1$ = LEFT$(V1$,K+1) + V2$ + MID$(V1$, K+3) BEND K = K + 1 LOOP V$(CURSOR¯Y, CHUNK¯IDX) = V1$ RETURN.CAN¯TRANSPOSE¯OCTAVE'-------------------- RET% = 1 K = 0 DO WHILE K < LEN(V1$) V2$ = MID$(V1$,K+1,1) IF V2$ = "O" AND (K+1) < LEN(V1$) THEN BEGIN V2$ = MID$(V1$,K+2,1) IF VAL(V2$) = LIMIT THEN RET% = 0 : RETURN BEND K = K + 1 LOOP RETURN.PLAY¯CHUNK¯IDX'-------------- V1$ = V$(0,CHUNK¯IDX) V2$ = V$(1,CHUNK¯IDX) V3$ = V$(2,CHUNK¯IDX) V4$ = V$(3,CHUNK¯IDX) V5$ = V$(4,CHUNK¯IDX) V6$ = V$(5,CHUNK¯IDX) IF ECHO¯DELAY = 1 THEN BEGIN PLAY V1$ SLEEP (ECHO¯SZ) PLAY ,V2$ SLEEP (ECHO¯SZ) PLAY ,,V3$ SLEEP (ECHO¯SZ) PLAY ,,,V4$ SLEEP (ECHO¯SZ) PLAY ,,,,V5$ SLEEP (ECHO¯SZ) PLAY ,,,,,V6$ SLEEP (ECHO¯SZ) RETURN BEND IF ECHO¯M = 0 AND ECHO¯B = 0 THEN BEGIN PLAY V1$, V2$, V3$, V4$, V5$, V6$ RETURN BEND IF ECHO¯M = 1 AND ECHO¯B = 0 THEN BEGIN PLAY V1$, V2$, V3$, , V5$, V6$ SLEEP (ECHO¯SZ) PLAY , , , V1$ BEND IF ECHO¯M = 1 AND ECHO¯B = 1 THEN BEGIN PLAY V1$, V2$, V3$, , V5$ SLEEP (ECHO¯SZ) PLAY , , , V1$, , V3$ BEND IF ECHO¯M = 2 AND ECHO¯B = 0 THEN BEGIN PLAY V1$, , V3$, , , V6$ SLEEP (ECHO¯SZ) PLAY , , , V1$ SLEEP (ECHO¯SZ) PLAY , V1$ SLEEP (ECHO¯SZ) PLAY , , , , V1$ BEND IF ECHO¯M = 2 AND ECHO¯B = 1 THEN BEGIN PLAY V1$, , V3$ SLEEP (ECHO¯SZ) PLAY , , , V1$ SLEEP (ECHO¯SZ) PLAY , V1$, , , , V3$ SLEEP (ECHO¯SZ) PLAY , , , , V1$ BEND RETURN.ENVELOPE¯EDITOR'--------------- DO WHILE 1 GOSUB DRAW¯TABLE GOSUB GET¯USER¯INPUT¯FOR¯TABLE ' ALT+Q TO EXIT IF A$ = ËÅÙ¯ÍÅÇÁ¯Ñ THEN EXIT LOOP RETURN.DRAW¯TABLE'---------- PRINT "“ENV EDITOR";ËÅÙ¯ÔÁÂ;DUR$(SDUR, ÄÎÁÍÅ);ËÅÙ¯ÔÁÂ;"OCTAVE";OCT PRINT "----------" PRINT "-/+: DECR/INCR, </>: OCTAVE, ÒÔÎ: EDIT, ÔÁÂ: FOCUS ENV/FILTER, ÍÅÇÁ+Ñ: EXIT" PRINT PRINT " ÎÁÍÅ";ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;"ÁÔÔÁÃË";ËÅÙ¯ÔÁÂ;"ÄÅÃÁÙ";ËÅÙ¯ÔÁÂ;"ÓÕÓÔÁÉÎ";ËÅÙ¯ÔÁÂ;"ÒÅÌÅÁÓÅ";ËÅÙ¯ÔÁÂ; PRINT "×ÁÖÅÆÒÍ";ËÅÙ¯ÔÁÂ;"ÐÕÌÓÅ×ÉÄÔÈ" FOR ROW = 0 TO 9 IF SROW = ROW THEN PRINT ">";:ELSE PRINT " "; PRINT ROW;": "; COL = 0 : V$ = ENVS¯NAME$(ROW) GOSUB SHOW¯CELL COL = 1 : V = ENVS¯ATTACK(ROW) GOSUB SHOW¯CELL COL = 2 : V = ENVS¯DECAY(ROW) GOSUB SHOW¯CELL COL = 3 : V = ENVS¯SUSTAIN(ROW) GOSUB SHOW¯CELL COL = 4 : V = ENVS¯RELEASE(ROW) GOSUB SHOW¯CELL COL = 5 : V = ENVS¯WAVEFORM(ROW) GOSUB SHOW¯CELL COL = 6 : V = ENVS¯PW(ROW) GOSUB SHOW¯CELL PRINT NEXT ROW PRINT PRINT "FILTER EDITOR" PRINT "-------------"; PRINT ËÅÙ¯ÔÁÂ;"FREQ";ËÅÙ¯ÔÁÂ;"LP";ËÅÙ¯ÔÁÂ;"BP";ËÅÙ¯ÔÁÂ;"HP";ËÅÙ¯ÔÁÂ;"RES"; PRINT ËÅÙ¯ÔÁÂ;"DIR";ËÅÙ¯ÔÁÂ;"MIN";ËÅÙ¯ÔÁÂ;"SWEEP" FOR FPRESET = 0 TO 10 GOSUB SHOW¯FILTER NEXT FPRESET RETURN.SHOW¯FILTER'----------- IF FSEL = FPRESET THEN PRINT ">";:ELSE PRINT " "; K = 0 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯NAME$(FPRESET);" ";ËÅÙ¯ÔÁÂ; K = 1 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯FREQ(FPRESET);ËÅÙ¯ÔÁÂ; K = 2 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯STATE¯NAME$(FILT¯LP(FPRESET));ËÅÙ¯ÔÁÂ; K = 3 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯STATE¯NAME$(FILT¯BP(FPRESET));ËÅÙ¯ÔÁÂ; K = 4 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯STATE¯NAME$(FILT¯HP(FPRESET));ËÅÙ¯ÔÁÂ; K = 5 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯RES(FPRESET);ËÅÙ¯ÔÁÂ; K = 6 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT DIR¯NAME$(FILT¯DIR(FPRESET));ËÅÙ¯ÔÁÂ; K = 7 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯MIN(FPRESET);ËÅÙ¯ÔÁÂ; K = 8 : GOSUB CHECK¯SHOW¯FILTER¯HIGHLIGHT PRINT FILT¯SWEEP(FPRESET); PRINT ËÅÙ¯ÒÅÖ¯ÏÆÆ RETURN.CHECK¯SHOW¯FILTER¯HIGHLIGHT'--------------------------- IF FSROW = FPRESET AND FFOCUS = 1 AND FSCOL = K THEN _ PRINT ËÅÙ¯ÒÅÖ¯ÏÎ; : ELSE PRINT ËÅÙ¯ÒÅÖ¯ÏÆÆ; RETURN.GET¯VAL'------- IF SCOL = 0 THEN V$ = ENVS¯NAME$(SROW) IF SCOL = 1 THEN V = ENVS¯ATTACK(SROW) IF SCOL = 2 THEN V = ENVS¯DECAY(SROW) IF SCOL = 3 THEN V = ENVS¯SUSTAIN(SROW) IF SCOL = 4 THEN V = ENVS¯RELEASE(SROW) IF SCOL = 5 THEN V = ENVS¯WAVEFORM(SROW) IF SCOL = 6 THEN V = ENVS¯PW(SROW) RETURN.SHOW¯CELL'--------- IF SROW=ROW AND SCOL = COL AND FFOCUS=0 THEN PRINT ËÅÙ¯ÒÅÖ¯ÏÎ;:ELSE PRINT ËÅÙ¯ÒÅÖ¯ÏÆÆ; IF COL = 0 THEN BEGIN PRINT V$;ËÅÙ¯ÔÁÂ;"’"; RETURN BEND IF COL = 5 THEN BEGIN PRINT WNAME$(V);ËÅÙ¯ÔÁÂ;ËÅÙ¯ÒÅÖ¯ÏÆÆ; RETURN BEND ' ELSE PRINT V;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÒÅÖ¯ÏÆÆ; RETURN.GET¯USER¯INPUT¯FOR¯TABLE'------------------------ ' GET KEY A$ GOSUB READ¯KEY¯LOOP IF A$ = ËÅÙ¯ÌÅÆÔ AND SCOL > 0 THEN SCOL = SCOL - 1 IF A$ = ËÅÙ¯ÒÉÇÈÔ AND SCOL < 6 THEN SCOL = SCOL + 1 IF A$ = ËÅÙ¯ÕÐ AND SROW > 0 THEN SROW = SROW - 1 IF A$ = ËÅÙ¯ÄÏ×Î AND SROW < 9 THEN SROW = SROW + 1 IF A$ = "+" OR A$="=" THEN DELTA=1 : GOSUB INCR¯VAL IF A$ = "-" THEN DELTA=1 : GOSUB DECR¯VAL IF A$ = ËÅÙ¯ÓÈÉÆÔ¯ÐÌÕÓ THEN DELTA=100 : GOSUB INCR¯VAL IF A$ = ËÅÙ¯ÓÈÉÆÔ¯ÍÉÎÕÓ THEN DELTA=100 : GOSUB DECR¯VAL IF A$ = ËÅÙ¯ÒÅÔÕÒÎ THEN A$ = "+" : GOSUB EDIT¯ENV¯FIELD IF A$ = ËÅÙ¯ÓÈÉÆÔ¯ÒÅÔÕÒÎ THEN A$ = "-" : GOSUB EDIT¯ENV¯FIELD IF A$ = ËÅÙ¯ÔÁ THEN FFOCUS = 1 : GOSUB GET¯USER¯INPUT¯FOR¯FILTERS GOSUB CHECK¯DURATION¯CHANGE GOSUB CHECK¯PIANO¯KEYS RETURN.GET¯USER¯INPUT¯FOR¯FILTERS'-------------------------- DO WHILE 1 GOSUB DRAW¯TABLE ' GET KEY A$ GOSUB READ¯KEY¯LOOP IF A$ = ËÅÙ¯ÌÅÆÔ AND FSCOL > 0 THEN FSCOL = FSCOL - 1 IF A$ = ËÅÙ¯ÒÉÇÈÔ AND FSCOL < 8 THEN FSCOL = FSCOL + 1 IF A$ = ËÅÙ¯ÕÐ AND FSROW > 0 THEN FSROW = FSROW - 1 IF A$ = ËÅÙ¯ÄÏ×Î AND FSROW < 10 THEN FSROW = FSROW + 1 IF A$ = "+" OR A$="=" THEN DELTA=1 : GOSUB INCR¯FVAL IF A$ = "-" THEN DELTA=1 : GOSUB DECR¯FVAL IF A$ = ËÅÙ¯ÓÈÉÆÔ¯ÐÌÕÓ THEN DELTA = 100 : GOSUB INCR¯FVAL IF A$ = ËÅÙ¯ÓÈÉÆÔ¯ÍÉÎÕÓ THEN DELTA = 100 : GOSUB DECR¯FVAL IF A$ = " " THEN BEGIN IF FSEL = FSROW THEN FSEL = -1:ELSE FSEL = FSROW GOSUB APPLY¯SELECTED¯FILTER BEND IF A$ = ËÅÙ¯ÒÅÔÕÒÎ THEN GOSUB EDIT¯FILTER¯FIELD:GOSUB APPLY¯SELECTED¯FILTER IF A$ = ËÅÙ¯ÔÁ OR A$ = ËÅÙ¯ÍÅÇÁ¯Ñ THEN EXIT GOSUB CHECK¯DURATION¯CHANGE GOSUB CHECK¯PIANO¯KEYS LOOP FFOCUS = 0 RETURN.READ¯KEY¯LOOP'------------- A$ = "" DO WHILE A$="" GET A$ IF FSEL <> -1 THEN BEGIN GOSUB UPDATE¯SELECTED¯FILTER BEND IF PLYFLAG = 1 THEN BEGIN IF RPLAY(1) = 0 THEN GOSUB PARSE¯CURRENT¯SEQPTR BEND LOOP RETURN.PARSE¯CURRENT¯SEQPTR'-------------------- K = SEQ¯CHUNK(PLYPTR) IF K >= 0 THEN BEGIN CHUNK¯IDX = K IF CHUNK¯RPT <= 0 THEN CHUNK¯RPT = SEQ¯EXTRA(PLYPTR) GOSUB PLAY¯CHUNK¯IDX SLEEP .1 GOSUB DRAW¯SEQUENCE BEND IF K = ÃÍįÔÅÍÐÏ THEN BEGIN K = SEQ¯EXTRA(PLYPTR) TEMPO (K) TMPO% = K BEND IF K = ÃÍįÆÉÌÔÅÒ THEN BEGIN K = SEQ¯EXTRA(PLYPTR) FSROW = K FSEL = K GOSUB APPLY¯SELECTED¯FILTER BEND IF K = ÃÍįÅÃÈϯÍ1 THEN ECHO¯M = 1 : ECHO¯DELAY = 0 IF K = ÃÍįÅÃÈϯÍ2 THEN ECHO¯M = 2 : ECHO¯DELAY = 0 IF K = ÃÍįÅÃÈϯ THEN ECHO¯B = 1 : ECHO¯DELAY = 0 IF K = ÃÍįÅÃÈϯÏÆÆ THEN ECHO¯M = 0 : ECHO¯B = 0 IF K = ÃÍįÅÃÈϯÓÚ THEN ECHO¯SZ = SEQ¯EXTRA(PLYPTR) IF K = ÃÍįÄÅÌÁÙ THEN ECHO¯DELAY = 1 : ECHO¯M = 0 : ECHO¯B = 0 IF K = ÃÍįÖÏÌ THEN V = SEQ¯EXTRA(PLYPTR) : VOL V, V IF CHUNK¯RPT > 0 THEN CHUNK¯RPT = CHUNK¯RPT - 1 IF CHUNK¯RPT <= 0 THEN PLYPTR = PLYPTR + 1 IF K = ÃÍįÌÏÏÐ THEN PLYPTR = 0 IF PLYPTR >= SEQCNT THEN PLYFLAG = 0 : PLYPTR = -1 RETURN.CHECK¯DURATION¯CHANGE'--------------------- FOR K = į×ÈÏÌÅ TO įÓÉØÔÅÅÎÔÈ IF A$ = DUR$(K, ÄËÅÙ) THEN SDUR = K NEXT K ' CHECK OCTAVE TOO IF A$ = ">" AND OCT < 6 THEN OCT = OCT + 1 IF A$ = "<" AND OCT > 0 THEN OCT = OCT - 1 RETURN.UPDATE¯SELECTED¯FILTER'---------------------- IF FSEL = -1 THEN RETURN IF CURR¯DIR = ÄÉÒ¯ÎÏÎÅ THEN RETURN PRINT "";ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;CHR$(27);"QCURR¯FREQ=";CURR¯FREQ; ' ÎÏÔÅ: ÃAN'T USE ÓÅÔÂÉÔ FOR ÓÉÄ REGISTERS AS THE REGS ARE WRITE-ONLY ' (ÓÅÔÂÉÔ WILL INTERNALLY NEED A READ PRIOR TO THE WRITE) ' ÂÕÇ? É COULDN'T DO ÐÏËÅ $Ä415 (IT BECAME 868691 = $Ä4153 ?!) WPOKE 54293, (CURR¯FREQ AND 7) + ((CURR¯FREQ >> 3) * 256) WPOKE 54357, (CURR¯FREQ AND 7) + ((CURR¯FREQ >> 3) * 256) IF CURR¯DIR = ÄÉÒ¯ÕÐ THEN BEGIN CURR¯FREQ = CURR¯FREQ + FILT¯SWEEP(FSEL) IF CURR¯FREQ > FILT¯FREQ(FSEL) THEN BEGIN CURR¯FREQ = FILT¯FREQ(FSEL) IF FILT¯DIR(FSEL) = ÄÉÒ¯ÏÓà THEN CURR¯DIR = ÄÉÒ¯ÄÏ×Î IF FILT¯DIR(FSEL) = ÄÉÒ¯ÕÐ THEN CURR¯FREQ = FILT¯MIN(FSEL) BEND RETURN BEND IF CURR¯DIR = ÄÉÒ¯ÄÏ×Î THEN BEGIN CURR¯FREQ = CURR¯FREQ - FILT¯SWEEP(FSEL) IF CURR¯FREQ < FILT¯MIN(FSEL) THEN BEGIN CURR¯FREQ = FILT¯MIN(FSEL) IF FILT¯DIR(FSEL) = ÄÉÒ¯ÏÓà THEN CURR¯DIR = ÄÉÒ¯ÕÐ IF FILT¯DIR(FSEL) = ÄÉÒ¯ÄÏ×Î THEN CURR¯FREQ = FILT¯FREQ(FSEL) BEND RETURN BEND RETURN.APPLY¯SELECTED¯FILTER'--------------------- IF FSEL = -1 THEN RETURN CURR¯FREQ = FILT¯FREQ(FSEL) CURR¯DIR = ÄÉÒ¯ÎÏÎÅ IF FILT¯DIR(FSEL) = ÄÉÒ¯ÕÐ _ OR FILT¯DIR(FSEL) = ÄÉÒ¯ÏÓà THEN BEGIN CURR¯FREQ = FILT¯MIN(FSEL) CURR¯DIR = ÄÉÒ¯ÕÐ BEND IF FILT¯DIR(FSEL) = ÄÉÒ¯ÄÏ×Î THEN BEGIN CURR¯DIR = ÄÉÒ¯ÄÏ×Î BEND FILTER 1, FILT¯FREQ(FSEL), FILT¯LP(FSEL), _ FILT¯BP(FSEL), FILT¯HP(FSEL), FILT¯RES(FSEL) FILTER 2, FILT¯FREQ(FSEL), FILT¯LP(FSEL), _ FILT¯BP(FSEL), FILT¯HP(FSEL), FILT¯RES(FSEL) RETURN.CHANGE¯ENV¯NAME'--------------- V$="" INPUT "NEW NAME: ",V$ IF V$<>"" THEN ENVS¯NAME$(SROW) = V$ RETURN.EDIT¯ENV¯FIELD'-------------- IF SCOL = 0 THEN GOSUB CHANGE¯ENV¯NAME : RETURN IF SCOL = 6 THEN BEGIN V$="" INPUT "NEW VALUE: ",V$ V = VAL(V$) IF V > 4095 THEN V = 4095 IF V < 0 THEN V = 0 ENVS¯PW(SROW) = V RETURN BEND IF A$="+" THEN DELTA=1 : GOSUB INCR¯VAL IF A$="-" THEN DELTA=1 : GOSUB DECR¯VAL RETURN.EDIT¯FILTER¯FIELD'----------------- IF FSCOL = 2 THEN V=FILT¯LP(FSROW):V=MOD(V+1,2):FILT¯LP(FSROW)=V:RETURN IF FSCOL = 3 THEN V=FILT¯BP(FSROW):V=MOD(V+1,2):FILT¯BP(FSROW)=V:RETURN IF FSCOL = 4 THEN V=FILT¯HP(FSROW):V=MOD(V+1,2):FILT¯HP(FSROW)=V:RETURN IF FSCOL = 6 THEN V=FILT¯DIR(FSROW):V=MOD(V+1,4):FILT¯DIR(FSROW)=V:RETURN V$="" INPUT "NEW VALUE: ",V$ IF V$<>"" THEN BEGIN IF FSCOL = 0 THEN FILT¯NAME$(FSROW) = V$ IF FSCOL = 1 THEN BEGIN V = VAL(V$) IF V > 2047 THEN V = 2047 IF V < 0 THEN V = 0 FILT¯FREQ(FSROW) = V BEND IF FSCOL = 5 THEN BEGIN V = VAL(V$) IF V > 15 THEN V = 15 IF V < 0 THEN V = 0 FILT¯RES(FSROW) = V BEND IF FSCOL = 6 THEN BEGIN V = VAL(V$) IF V > 3 THEN V = 3 IF V < 0 THEN V = 0 FILT¯DIR(FSROW) = V BEND IF FSCOL = 7 THEN BEGIN V = VAL(V$) IF V > 2047 THEN V = 2047 IF V < 0 THEN V = 0 FILT¯MIN(FSROW) = V BEND IF FSCOL = 8 THEN BEGIN V = VAL(V$) IF V > 2047 THEN V = 2047 IF V < 0 THEN V = 0 FILT¯SWEEP(FSROW) = V BEND BEND.CHECK¯PIANO¯KEYS'---------------- ' APPLY FILTER PSTR$ = "X0" IF FSEL <> -1 THEN PSTR$ = "X1" ' DECIDE NOTE LENGTH PSTR$ = PSTR$ + DUR$(SDUR, ÄÃÈÁÒ) ' DECIDE OCTAVE PSTR$ = PSTR$ + "O" + STR$(OCT) ' WHICH NOTE TO PLAY FOR K = 0 TO 11 IF A$ = KEYS¯IN$(K) THEN PSTR$ = PSTR$ + KEYS¯OUT$(K) NEXT K IF LEN(PSTR$)>0 THEN BEGIN PLAY "T"+STR$(SROW)+PSTR$ BEND RETURN.INCR¯VAL'-------- GOSUB GET¯VAL MAXV = 15 IF SCOL = 5 THEN MAXV = 4 IF SCOL = 6 THEN MAXV = 4095 V = V + DELTA IF V > MAXV THEN V = MAXV GOSUB APPLY¯VAL RETURN.DECR¯VAL'-------- GOSUB GET¯VAL V = V - DELTA IF V < 0 THEN V = 0 GOSUB APPLY¯VAL RETURN.INCR¯FVAL'--------- IF FSCOL = 1 THEN BEGIN V = FILT¯FREQ(FSROW) + DELTA IF V > 2047 THEN V = 2047 FILT¯FREQ(FSROW) = V BEND IF FSCOL = 2 THEN FILT¯LP(FSROW) = 1 IF FSCOL = 3 THEN FILT¯BP(FSROW) = 1 IF FSCOL = 4 THEN FILT¯HP(FSROW) = 1 IF FSCOL = 5 THEN BEGIN V = FILT¯RES(FSROW) + DELTA IF V > 15 THEN V = 15 FILT¯RES(FSROW) = V BEND IF FSCOL=6 AND FILT¯DIR(FSROW) < 3 THEN FILT¯DIR(FSROW) = FILT¯DIR(FSROW) + 1 IF FSCOL=7 AND FILT¯MIN(FSROW) < 2047 THEN BEGIN V = FILT¯MIN(FSROW) + DELTA IF V > 2047 THEN V = 2047 FILT¯MIN(FSROW) = V BEND IF FSCOL=8 AND FILT¯SWEEP(FSROW) < 2047 THEN BEGIN V = FILT¯SWEEP(FSROW) + DELTA IF V > 2047 THEN V = 2047 FILT¯SWEEP(FSROW) = V BEND GOSUB APPLY¯SELECTED¯FILTER RETURN.DECR¯FVAL'--------- IF FSCOL = 1 THEN BEGIN V = FILT¯FREQ(FSROW) - DELTA IF V < 0 THEN V = 0 FILT¯FREQ(FSROW) = V BEND IF FSCOL = 2 THEN FILT¯LP(FSROW) = 0 IF FSCOL = 3 THEN FILT¯BP(FSROW) = 0 IF FSCOL = 4 THEN FILT¯HP(FSROW) = 0 IF FSCOL = 5 THEN BEGIN V = FILT¯RES(FSROW) - DELTA IF V < 0 THEN V = 0 FILT¯RES(FSROW) = V BEND IF FSCOL=6 AND FILT¯DIR(FSROW) > 0 THEN FILT¯DIR(FSROW) = FILT¯DIR(FSROW) - 1 IF FSCOL=7 AND FILT¯MIN(FSROW) > 0 THEN BEGIN V = FILT¯MIN(FSROW) - DELTA IF V < 0 THEN V = 0 FILT¯MIN(FSROW) = V BEND IF FSCOL=8 AND FILT¯SWEEP(FSROW) > 0 THEN BEGIN V = FILT¯SWEEP(FSROW) - DELTA IF V < 0 THEN V = 0 FILT¯SWEEP(FSROW) = V BEND GOSUB APPLY¯SELECTED¯FILTER RETURN.APPLY¯VAL'--------- IF SCOL=0 THEN ENVS¯NAME$(SROW) = V$ IF SCOL=1 THEN ENVS¯ATTACK(SROW) = V IF SCOL=2 THEN ENVS¯DECAY(SROW) = V IF SCOL=3 THEN ENVS¯SUSTAIN(SROW) = V IF SCOL=4 THEN ENVS¯RELEASE(SROW) = V IF SCOL=5 THEN ENVS¯WAVEFORM(SROW) = V IF SCOL=6 THEN ENVS¯PW(SROW) = V ROW = SROW GOSUB SET¯ENV RETURN.SET¯ENV'------- ENVELOPE ROW, ENVS¯ATTACK(ROW), ENVS¯DECAY(ROW), ENVS¯SUSTAIN(ROW), ENVS¯RELEASE(ROW), ENVS¯WAVEFORM(ROW), ENVS¯PW(ROW) RETURN.RUNSTOP¯TRAPPER'--------------- IF ER=30 THEN RESUME ' IGNORE RUN/STOP TRAP PRINT ERR$(ER);" ERROR" PRINT " IN LINE";EL KEY ON END.CHUNK¯SEQUENCER'--------------- DO WHILE 1 GOSUB DRAW¯SEQUENCE GOSUB GET¯USER¯INPUT¯FOR¯SEQUENCE IF A$ = ËÅÙ¯ÍÅÇÁ¯Ñ THEN EXIT LOOP RETURN.DRAW¯SEQUENCE'------------- PRINT "“SEQUENCE EDITOR" PRINT "---------------" PRINT "Á)DD É)NSERT Ä)ELETE, ÅDIT=ÒÔÎ, ÐLAYÁLL=ÓÈÆÔ+ÒÔÎ, ÐLAY=ÓÐà - SEQCNT = ";SEQCNT PRINT "Ã: EDIT ÃÍÄ, ÅÓÃ: STOP MUSIC, ÍÅÇÁ+Ñ: EXIT" PRINT " ÃMD ÅXTRA" PRINT " --- -----" IF INT((SEQCNT-1)/43) > 1 AND (INT(SEQ¯OFFS/43)+1) < INT((SEQCNT-1)/43) THEN BEGIN 'IF INT((SEQCNT-1) / 43) * 43 > SEQ¯OFFS THEN BEGIN CURSOR 75, 5:PRINT "--->" 'BEND BEND IF SEQ¯OFFS > 0 THEN BEGIN CURSOR 70, 5:PRINT "<---" BEND K = SEQ¯OFFS DO WHILE K < SEQCNT IF K > (SEQ¯OFFS + 43 * 2 - 1) THEN K=SEQCNT:GOTO NXT IF (K-SEQ¯OFFS) >= 43 THEN CURSOR 40,6+(K-SEQ¯OFFS-43) IF PLYPTR = K THEN PRINT ">";:ELSE PRINT " "; S=0:GOSUB HIGHLIGHT¯SELECTED¯SEQ¯COLUMN ' CHUNK IS A SPECIAL ÃÍį*? IF SEQ¯CHUNK(K) < 0 AND ABS(SEQ¯CHUNK(K)) < ÃÍįÍÁØ THEN BEGIN V$ = SEQ¯CMDNAME$(ABS(SEQ¯CHUNK(K))) S = 10-LEN(V$) PRINT V$; DO WHILE S >= 0 PRINT " "; S = S - 1 LOOP BEND:ELSE BEGIN PRINT SEQ¯CHUNK(K);ËÅÙ¯ÔÁÂ; BEND S=1:GOSUB HIGHLIGHT¯SELECTED¯SEQ¯COLUMN HANDLED = 0 IF SEQ¯CHUNK(K) = ÃÍįÆÉÌÔÅÒ THEN BEGIN HANDLED = 1 IF SEQ¯EXTRA(K) = -1 THEN PRINT ËÅÙ¯ÔÁÂ;"<NONE>":ELSE BEGIN PRINT ËÅÙ¯ÔÁÂ;FILT¯NAME$(SEQ¯EXTRA(K)) BEND BEND IF HANDLED=0 AND SEQ¯CHUNK(K) = ÃÍįÔÅÍÐÏ THEN BEGIN HANDLED = 1 PRINT ËÅÙ¯ÔÁÂ;SEQ¯EXTRA(K) BEND ' ÅÌÓÅ IF HANDLED = 0 THEN BEGIN PRINT ËÅÙ¯ÔÁÂ;SEQ¯EXTRA(K) BEND PRINT ËÅÙ¯ÒÅÖ¯ÏÆÆ;.NXT K = K + 1 LOOP RETURN.HIGHLIGHT¯SELECTED¯SEQ¯COLUMN'----------------------------- IF SEQPTR = K AND SSCOL=S THEN PRINT ËÅÙ¯ÒÅÖ¯ÏÎ;:ELSE PRINT ËÅÙ¯ÒÅÖ¯ÏÆÆ; RETURN.GET¯USER¯INPUT¯FOR¯SEQUENCE'--------------------------- GOSUB READ¯KEY¯LOOP IF A$="A" THEN GOSUB ADD¯CHUNK¯TO¯SEQ IF A$="I" THEN GOSUB INSERT¯CHUNK¯TO¯SEQ ' IF A$="E" THEN GOSUB EDIT¯CHUNK¯SEQ IF A$="D" THEN GOSUB DELETE¯CHUNK¯SEQ IF A$=ËÅÙ¯ÕÐ AND SEQPTR > 0 THEN SEQPTR = SEQPTR - 1 IF A$=ËÅÙ¯ÄÏ×Î AND SEQPTR < SEQCNT-1 THEN SEQPTR = SEQPTR + 1 IF A$=ËÅÙ¯ÌÅÆÔ THEN BEGIN IF SSCOL = 1 THEN BEGIN SSCOL = 0 BEND:ELSE BEGIN IF (SEQPTR-43)>=0 THEN BEGIN SSCOL = 1 SEQPTR = SEQPTR - 43 BEND BEND BEND IF A$=ËÅÙ¯ÒÉÇÈÔ THEN BEGIN IF SSCOL = 0 THEN BEGIN SSCOL = 1 BEND:ELSE BEGIN IF (SEQPTR+43) < SEQCNT THEN BEGIN SSCOL = 0 SEQPTR = SEQPTR + 43 BEND BEND BEND IF A$=ËÅÙ¯ÓÈÉÆÔ¯ÒÅÔÕÒÎ THEN BEGIN PLYPTR = 0 PLYFLAG = 1 CHUNK¯RPT = 0 PLAY GOSUB SET¯ALL¯ENV TEMPO TMPO% BEND IF A$=ËÅÙ¯ÓÐÁÃÅ THEN BEGIN PLYPTR = SEQPTR PLYFLAG = 1 CHUNK¯RPT = 0 PLAY GOSUB SET¯ALL¯ENV TEMPO TMPO% BEND IF A$=ËÅÙ¯ÒÅÔÕÒÎ THEN GOSUB EDIT¯CHUNK¯CELL IF A$="C" THEN GOSUB EDIT¯CHUNK¯CMD IF A$=ËÅÙ¯ÅÓÃÁÐÅ THEN GOSUB STOP¯ALL¯MUSIC IF A$=ËÅÙ¯ÈÏÍÅ THEN SEQPTR = 0 IF A$=ËÅÙ¯ÃÌÒ THEN SEQPTR = SEQCNT-1 ' FINALLY, ADJUST SEQ¯OFFS IF NEEDBE IF (INT(SEQPTR / 43) * 43) < SEQ¯OFFS THEN SEQ¯OFFS = SEQ¯OFFS - 43 IF (INT(SEQPTR / 43) * 43) > (SEQ¯OFFS+43) THEN SEQ¯OFFS = SEQ¯OFFS + 43 RETURN.STOP¯ALL¯MUSIC'-------------- PLYPTR = -1 PLYFLAG = 0 PLAY GOSUB SET¯ALL¯ENV TEMPO TMPO% GOSUB APPLY¯SELECTED¯FILTER RETURN.DELETE¯CHUNK¯SEQ'---------------- IF SEQCNT = 0 THEN RETURN K = SEQPTR DO WHILE K < SEQCNT - 1 SEQ¯CHUNK(K) = SEQ¯CHUNK(K + 1) SEQ¯EXTRA(K) = SEQ¯EXTRA(K + 1) K = K + 1 LOOP SEQCNT = SEQCNT - 1 IF SEQPTR = SEQCNT AND SEQPTR>0 THEN SEQPTR = SEQPTR - 1 RETURN.EDIT¯CHUNK¯SEQ'-------------- IF SEQCNT = 0 THEN RETURN PRINT ËÅÙ¯ÈÏÍÅ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÅÓÃÁÐÅ;"Q"; V=0:INPUT "CHUNK#: ", V SEQ¯CHUNK(SEQPTR) = V PRINT ËÅÙ¯ÈÏÍÅ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÅÓÃÁÐÅ;"Q"; V=-1:INPUT "EXTRA#: ", V SEQ¯EXTRA(SEQPTR) = V RETURN.EDIT¯CHUNK¯CELL'--------------- IF SEQCNT = 0 THEN RETURN PRINT ËÅÙ¯ÈÏÍÅ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÔÁÂ;ËÅÙ¯ÅÓÃÁÐÅ;"Q"; IF SSCOL = 0 THEN BEGIN V = SEQ¯CHUNK(SEQPTR) V1$ = STR$(V) IF LEFT$(V1$,1) = " " THEN V1$=MID$(V1$,2) PRINT "CHUNK#: ";ËÅÙ¯ÅÓÃÁÐÅ;"^";V1$;ËÅÙ¯ÅÓÃÁÐÅ;"_"; INPUT "", V SEQ¯CHUNK(SEQPTR) = V BEND IF SSCOL = 1 THEN BEGIN V = SEQ¯EXTRA(SEQPTR) V1$ = STR$(V) IF LEFT$(V1$,1) = " " THEN V1$=MID$(V1$,2) PRINT "EXTRA#: ";ËÅÙ¯ÅÓÃÁÐÅ;"^";V1$;ËÅÙ¯ÅÓÃÁÐÅ;"_"; INPUT "", V SEQ¯EXTRA(SEQPTR) = V BEND RETURN.EDIT¯CHUNK¯CMD'-------------- V = -SEQ¯CHUNK(SEQPTR) PRINT ËÅÙ¯ÃÌÒ; FOR ROW = 1 TO ÃÍįÍÁØ - 1 PRINT ROW;":"; SEQ¯CMDNAME$(ROW) NEXT ROW PRINT INPUT "CMD: ", V IF V > 0 THEN SEQ¯CHUNK(SEQPTR) = -V RETURN.INSERT¯CHUNK¯TO¯SEQ'------------------- SEQCNT = SEQCNT + 1 ' MOVE ALL HIGHER CHUNK SEQUENCES UP ONE K = SEQCNT - 2 DO WHILE K >= SEQPTR SEQ¯CHUNK(K+1) = SEQ¯CHUNK(K) SEQ¯EXTRA(K+1) = SEQ¯EXTRA(K) K = K - 1 LOOP SEQ¯CHUNK(SEQPTR) = 0 SEQ¯EXTRA(SEQPTR) = 0 RETURN.ADD¯CHUNK¯TO¯SEQ'---------------- SEQPTR = SEQCNT SEQCNT = SEQCNT + 1 SEQ¯CHUNK(SEQPTR) = 0 SEQ¯EXTRA(SEQPTR) = 0 RETURN