10DEFFNS="EnvEdit"
20MODE7:VDU23;8202;0;0;0;
30PROCprt("Envelope editor by C.J.Ric
hardson")
40PROCinf
50Q%=6:*FX202,144
60DIM T%(Q%),P1%(Q%),P2%(Q%),P3%(Q%),
L1%(Q%),L2%(Q%),L3%(Q%),AA%(Q%),AD%(Q%),
AS%(Q%),AR%(Q%),ALA%(Q%),ALD%(Q%)
70N%=1
80FORL%=1TOQ%:READT%(L%):READP1%(L%):
READP2%(L%):READP3%(L%):READL1%(L%):READ
L2%(L%):READL3%(L%):READAA%(L%):READAD%(
L%):READAS%(L%):READAR%(L%):READALA%(L%)
:READALD%(L%):NEXT
90P%=120:A%=80:D%=1
100ONERRORMODE0:PROCerr
110MODE1:VDU19,2,2,0,0,0,19,3,6,0,0,0,
23;8202;0;0;0;28,0,31,39,22,24,0;342;127
9;1023;
120PROCdraw
130REPEAT
140CLS
150COLOUR 3
160PRINT"Envelope=";N%" Step length+r
epeat="T%(N%);:COLOUR1:PRINTTAB(36);"Q W
"
170COLOUR2:PRINT"Pitch change 1="STR$P
1%(N%);TAB(20,1);"2="STR$P2%(N%);TAB(28,
1);"3="STR$P3%(N%);:COLOUR1:PRINTTAB(36,
1);"ASD"
180COLOUR3:PRINT"Pitch length 1="STR$L
1%(N%);TAB(20,2);"2="STR$L2%(N%);TAB(28,
2);"3="STR$L3%(N%);:COLOUR1:PRINTTAB(36,
2);"FGH"
190COLOUR2
200PRINT"Amplitude : Att Dec Sus R
el"
210PRINT "Change rate:";TAB(13,4);AA%(
N%);TAB(18,4);AD%(N%);TAB(23,4);AS%(N%);
TAB(28,4);AR%(N%);:COLOUR1:PRINTTAB(35,4
);"ZXCV"
220COLOUR3:PRINT"Attack target="STR$AL
A%(N%);TAB(18,5);"Decay target="STR$ALD%
(N%);:COLOUR1:PRINTTAB(35,5);"BN"
230COLOUR2:PRINT"Pitch=";P%;" Duration
=";A%
240COLOUR1:PRINTTAB(35,6);"PO"
250PRINT"Space";:COLOUR3:PRINT" for so
und.";:COLOUR1:PRINT" ESCAPE";:COLOUR3:P
RINT" for parameters.":COLOUR1:PRINT"J";
:COLOUR3:PRINT" Toggle jumps of 1,10 or
50. Now:";STR$D%:COLOUR1:PRINT"SHIFT";:C
OLOUR3:PRINT" to reduce parameter";
260*FX21
270REPEAT:A$=GET$:OSCLI"FX15":IF A$="
"SOUND 1,1,P%,A%
280UNTILA$<>" ":IFA$="J" IFD%=1 D%=10
ELSE IF A$="J" IFD%=10 D%=50 ELSE IF A$=
"J"D%=1
290Z%=ASCA$:IFZ%>96 A$=CHR$(Z%-32):Z%=
-D% ELSE Z%=D%
300IF A$="Q"N%=N%+Z%:IFN%<1N%=1 ELSE I
F N%>Q% N%=Q%
310IF A$="W"T%(N%)=T%(N%)+Z%:IFT%(N%)<
1T%(N%)=1
320IF A$="A"P1%(N%)=P1%(N%)+Z%
330IF A$="S"P2%(N%)=P2%(N%)+Z%
340IF A$="D"P3%(N%)=P3%(N%)+Z%
350IF A$="F"L1%(N%)=L1%(N%)+Z%:IFL1%(N
%)<0L1%(N%)=0
360IF A$="G"L2%(N%)=L2%(N%)+Z%:IFL2%(N
%)<0L2%(N%)=0
370IF A$="H"L3%(N%)=L3%(N%)+Z%:IFL3%(N
%)<0L3%(N%)=0
380IF A$="Z"AA%(N%)=AA%(N%)+Z%
390IF A$="X"AD%(N%)=AD%(N%)+Z%
400IF A$="C"AS%(N%)=AS%(N%)+Z%
410IF A$="V"AR%(N%)=AR%(N%)+Z%
420IF A$="B"ALA%(N%)=ALA%(N%)+Z%:IFALA
%(N%)<0ALA%(N%)=0
430IF A$="N"ALD%(N%)=ALD%(N%)+Z%:IFALD
%(N%)<0ALD%(N%)=0
440IF A$="O"A%=A%+Z%
450IF A$="P"P%=P%+Z%
460PROCdraw
470UNTILFALSE
480DEFPROCdraw
490ENVELOPE 1,T%(N%),P1%(N%),P2%(N%),P
3%(N%),L1%(N%),L2%(N%),L3%(N%),AA%(N%),A
D%(N%),AS%(N%),AR%(N%),ALA%(N%),ALD%(N%)
500CLG:C%=0:IFT%(N%)>128 M%=T%(N%)-128
ELSEM%=T%(N%)
510H%=(1024-675)*P%/255:IFA%<30 S%=3EL
SES%=1
520GCOL0,3
530MOVE0,(675+H%):PLOT25,1279,0
540MOVE0,(675+H%):Y%=0:K%=0:GCOL0,2
550PROCf(P1%(N%),L1%(N%),1)
560PROCf(P2%(N%),L2%(N%),1)
570PROCf(P3%(N%),L3%(N%),1)
580IFT%(N%)<128GCOL0,1:PLOT 17,0,-Y%:Y
%=0:K%=0:PROCf(P1%(N%),L1%(N%),17):PROCf
(P2%(N%),L2%(N%),17):PROCf(P3%(N%),L3%(N
%),17)
590MOVE0,340:X%=0:Y%=1:PROCa(AA%(N%),A
LA%(N%)):B%=X%
600GCOL0,2:I%=2000:IFC%=0:PROCa(AD%(N%
),ALD%(N%)-ALA%(N%)):I%=X%:GCOL0,1:IFC%=
0PROCb(AS%(N%),-ALD%(N%)):GCOL0,2:L%=V%+
I%
610PROCd:VDU5:GCOL3,6:MOVE0,368:PRINT"
Amplitude":GCOL3,3:MOVE0,1023:PRINT"Pitc
h"
620MOVEB%,700:PRINT"<Attack"
630MOVEI%,660:PRINT"<Decay"
640MOVEL%,620:PRINT"<Sustain"
650VDU4:ENDPROC
660DEFPROCf(R%,E%,F%)
670V%=E%*20*S%:W%=R%*E%*1.35:Y%=Y%+W%
680REPEAT:Z%=0
690IFY%<=349-H% ANDY%>=-H% PLOTF%,V%,W
%
700IF Y%>349-H% J%=W%:W%=-K%+349-H%:G%
=V%:V%=V%*W%/J%:PLOT F%,V%,W%:PLOT 17,0,
-349:W%=Y%-(349-H%):V%=G%-V%:Y%=W%-H%:K%
=-H%:Z%=1
710IF Y%<-H% J%=W%:W%=-(H%+K%):G%=V%:V
%=V%*ABS(W%/J%):PLOT F%,V%,W%:PLOT 17,0,
349:W%=Y%+H%:V%=G%-V%:Y%=349-H%+W%:K%=34
9-H%:Z%=1
720UNTILZ%=0:K%=K%+W%:ENDPROC
730DEFPROCa(O%,U%):PROCz:X%=X%+V%:Y%=Y
%+W%:PROCc:PROCp:ENDPROC
740DEFPROCb(O%,U%):PROCz:X%=X%+V%:Y%=Y
%+W%:PROCc:IFY%<0 V%=V%-V%*Y%/W%:W%=W%-Y
%:Y%=0:C%=1
750PROCp:ENDPROC
760DEFPROCd:IFAR%(N%)=0 V%=1280:W%=0 E
LSE V%=(ABS(Y%/AR%(N%)*8))*S%:W%=-Y%:Y%=
0
770PROCp:ENDPROC
780DEFPROCz:IFO%=0 V%=A%*100/M%*S%-X%:
W%=0:C%=1:ELSE V%=(ABS(U%/O%*20))*S%:W%=
U%*2.6
790ENDPROC
800DEFPROCp:PLOT0,0,-(Y%-W%):PLOT81,V%
,0:IFY%<0 ENDPROC ELSEPLOT0,-V%,Y%-W%:PL
OT81,V%,W%:ENDPROC
810DEFPROCc:IFX%>A%*100/M%*S% G%=V%:V%
=V%-(X%-(A%*100/M%*S%)):J%=W%:W%=W%*V%/G
%:Y%=Y%-(J%-W%):C%=1
820ENDPROC
830DEFPROCerr
840IF ERR=17FORL%=1TOQ%:PRINT"Envelope
";STR$L%;",";T%(L%);",";P1%(L%);",";P2%(
L%);",";P3%(L%);",";L1%(L%);",";L2%(L%);
",";L3%(L%);",";AA%(L%);",";AD%(L%);",";
AS%(L%);",";AR%(L%);",";ALA%(L%);",";ALD
%(L%):NEXT
850IFERR=17:PRINT"SOUND1,";N%;",";P%;"
,";A%
860REPORT:PRINTERL:PRINT"Press a key":
REPEATUNTILGET:ENDPROC
870DEFPROCprt(A$):A$=A$+STRING$(LENA$M
OD2," "):FORL%=1TOLENA$:PRINTTAB(18-L%/2
);"
,L%/2):VDU11,11:NEXT:VDU10,10:ENDPROC
880DATA10,10,-20,30,10,10,5,50,-10,-1,
-5,126,100
890DATA10,0,0,0,10,10,10,126,-15,-5,-1
,126,100
900DATA1,1,-1,0,1,1,0,126,-1,-1,-1,126
,100
910DATA1,0,0,0,0,0,0,126,0,0,-50,126,1
26
920DATA1,0,0,0,0,0,0,126,-5,-1,-1,126,
100
930DATA129,-1,1,0,1,1,0,100,-10,-10,-1
,100,90
940DEFPROCinf:VDU14
950PRINT'" This envelope editor will a
llow you see";
960PRINT" envelopes that you have edit
ed."'
970PRINT" The display is in 3 parts."'
980PRINT" 1. The top part of the displ
ay shows"
990PRINT" you the 6 envelope freque
ncy"
1000PRINT" parameters in a line grap
h."
1010PRINT" The initial repeat is in
cyan,"
1020PRINT" a further repeat is shown
in red."'
1030PRINT" 2. The middle part of the di
splay shows";
1040PRINT" you the 6 envelope amplit
ude"
1050PRINT" parameters."'
1060PRINT" 3. The lower part of the dis
play shows"
1070PRINT" you the actual values of
the"
1080PRINT" envelope and sound comman
ds."'
1090PRINT" Changing the parameters."'
1100PRINT" PRESS SHIFT TO SCROLL"
1110PRINT" "'
1120PRINT" SHIFT + KEY will cause the c
hange to be";
1130PRINT" negative"'
1140PRINT" Q Envelope"
1150PRINT" W Step length and repeat"
1160PRINT" A pitch change in step 1"
1170PRINT" S pitch change in step 2"
1180PRINT" D pitch change in step 3"'
1190PRINT" F length of step 1"
1200PRINT" G length of step 2"
1210PRINT" H length of step 3"'
1220PRINT" Z Attack level"
1230PRINT" X Decay level"
1240PRINT" C Sustain level"
1250PRINT" V Release level"'
1260PRINT" B Attack target"
1270PRINT" N Decay target"'
1280PRINT" P Sound pitch"
1290PRINT" O Sound duration"'
1300PRINT" The keys are summarised on t
he screen"'
1310PRINT" Press space to hear the soun
d."'
1320PRINT" Press escape to see the e
nvelope and";
1330PRINT" sound parameters."
1340PRINT'" Press a key":REPEATUNTILGE
T
1350*K.0 40|MDEL.940,1370|MRUN|M
1360*FX138 0 128
1370END