home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1992 January
/
1992-01.d64
/
synthesizer
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
244 lines
0 clr
5 ifpeek(49152)<>169thenpoke53265,0:load"synth ml",8,1
10 sys49152:kb$(0)="[208]oly":kb$(1)="[211]olo":kb$(2)="[194]i-voice":kb$(3)="[212]ri-voice"
13 wv$(1)="[212]ria":wv$(2)="[211]awt":wv$(3)="[212]r[211]a":wv$(4)="[208]uls":wv$(5)="[208]u[212]r"
14 wv$(6)="[208]u[211]a":wv$(7)="[208]u[212][211]":wv$(8)="[206]oiz":xp=14:yp=7
15 dimk(76),m(31):fort=1to24:reada,b:k(b)=a:next:poke53248,125:poke53249,90
20 s=54272:m(5)=15:m(4)=17:m(25)=4:kb=197:m(3)=5:m(24)=31:m(23)=240:m(22)=200
25 m(28)=25:m(29)=25:m(30)=25:b=24:b$=" =[147][133]":fort=stos+24:poket,0:nextt
27 fort=0to2:poke49248+t*3,m(28)+t:next
30 pokes+22,m(22):pokes+24,m(24):poke53264,0:gosub320:poke53265,27
35 data 8583,62,9094,31,9634,68,10207,32,10814,50,11457,63,12139,34,12860,65
40 data 13625,35,14435,70,15294,36,16203,66,17167,54,18188,38,19269,60
45 data 20415,29,21629,61,22915,45,24278,26,25721,23,27251,73,28871,75,30588,0
50 data 32407,1
55 rem ** which keyboard mode? **
60 ifm(31)=1then125
70 ifm(31)=2then230
75 ifm(31)=3then175
80 ifpeek(56320)<>127then430
85 geta$:ifa$=""then80
90 ifasc(a$)>95orasc(a$)<19then280
95 f=k(asc(a$)-19)/m(25+v/7):iff=0then280
100 h=int(f/256):l=f-(256*h)
105 pokes+4+v,m(v+4)and254:pokes+v,l:pokes+1+v,h
110 pokes+4+v,m(v+4)or1:v=v+7:ifv=21thenv=0
115 goto80
120 rem ** solo **
125 geta$:ifpeek(56320)<>127then430
130 ifa$=""then155
135 ifasc(a$)>95orasc(a$)<19then280
140 f=k(asc(a$)-19)/m(25):iff=0then280
145 h=int(f/256):l=f-(256*h)
150 pokes,l:pokes+1,h:pokes+4,m(4)
155 ifpeek(kb)<>64then125
160 ifpeek(kb)=64thenpokes+4,m(4)and254
165 goto125
170 rem ** tri-voice **
175 geta$:ifpeek(56320)<>127then430
180 ifa$=""then210
185 ifasc(a$)>95orasc(a$)<19then280
190 forv=0to14step7:f=k(asc(a$)-19)/m(25+v/7):iff=0then280
195 h=int(f/256):l=f-(256*h):ifl-14<0thenl=l+14
200 pokes+1+v,h:pokes+v,l-v:next:v=0
205 forv=0to14step7:pokes+4+v,m(v+4)or1:next:v=0
210 ifpeek(kb)<>64then175
215 ifpeek(kb)=64thenforv=0to14step7:pokes+4+v,m(v+4)and254:next:v=0
220 goto175
225 rem ** bi-voice **
230 geta$:ifpeek(56320)<>127then430
235 ifa$=""then260
240 ifasc(a$)>95orasc(a$)<19then280
245 forv=0to7step7:f=k(asc(a$)-19)/m(25+v/7):iff=0then280
250 h=int(f/256):l=f-(256*h):ifl<7thenl=l+7
255 pokes+v,l-v:pokes+1+v,h:next:v=0:pokes+4,m(4)or1:pokes+11,m(11)or1
260 ifpeek(kb)<>64thengoto230
265 ifpeek(kb)=64thenforv=0to14step7:pokes+4+v,m(v+4)and254:next:v=0
270 goto230
275 rem ** kb mode, equalize, run **
280 fort=1to4:ifa$<>mid$(b$,t,1)thennext:goto60
281 ontgoto295,288,287,282
282 print""
283 sys50078,128,m(24),24:m(24)=peek(780)
284 ifm(24)and128thenprinttab(29)"[154][207]ff":goto60
285 printtab(29)" ":goto60
287 run
288 gosub320:goto60
290 rem ** keyboard mode **
295 forv=0to14step7:pokes+4+v,m(v+4)and254:next:v=0:m(31)=m(31)+1
300 pokes+14,m(14):pokes+15,m(15):ifm(31)=4thenm(31)=0
305 print""tab(20)kb$(m(31))" ":goto60
315 rem ** equalize voices **
320 forv=0to14step7:m(v+2)=m(e+2):m(v+3)=m(e+3):m(v+4)=m(e+4):m(v+5)=m(e+5)
323 m(v+6)=m(e+6):m(25+v/7)=m(25+e/7)
325 pokes+2+v,m(e+2):pokes+3+v,m(e+3):pokes+5+v,m(e+5):pokes+6+v,m(e+6)
326 pokes+4+v,m(e+4):next
327 rem ** print values **
330 print""tab(20)kb$(m(31))
335 forv=0to14step7:t=7+v/7*13:print""
337 printtab(t+1)wv$((m(e+4)and240)/16)
340 printtab(t)" [157][157][157][157][157]"m(e+2)+m(e+3)*256"[156]"
345 if(m(e+4)and4)=0thenprinttab(t)" [207]ff":goto350
347 printtab(t)" [207]n "
350 if(m(e+4)and2)=0thenprinttab(t)" [207]ff":goto360
355 printtab(t)" [207]n "
360 print"[150]"tab(t)(m(e+5)and240)/16"[157] "
365 printtab(t)m(e+5)and15"[157] "
370 printtab(t)(m(e+6)and240)/16"[157] "
375 printtab(t)m(e+6)and15"[157] "
380 print""tab(t)6-(log(m(e/7+25))/log(2)):next:v=0
385 print"[159]"tab(14)m(21)+m(22)*8"[158]"tab(31)m(14)+m(15)*256
390 ifm(23)and1thenprinttab(15)"[159]1[145]"
392 ifm(23)and2thenprinttab(17)"[159]2[145]"
394 ifm(23)and4thenprinttab(19)"[159]3[145]"
395 print"[158]"tab(31)m(28)
400 ifm(24)and16thenprinttab(15)"[159][204]p[145]"
401 ifm(24)and64thenprinttab(18)"[159][200]p[145]"
402 ifm(24)and32thenprinttab(21)"[159][194]p[145]"
405 print"[158]"tab(31)m(29)
410 print"[159]"tab(14)(m(23)and240)/16"[158]"tab(31)m(30)
415 print"[159]"tab(14)m(24)and15
420 return
425 rem ** move, voices 15+15*8 34+7*8
430 ifyp>16then570
435 poke53248,13+xp*8:poke53249,34+yp*8
440 j=peek(56320):ifj=127then60
443 if(jand16)=0then634
445 if(jand1)=0andyp<>7thenyp=yp-1
500 if(jand2)=0thenyp=yp+1:ifyp=16thenyp=19:goto570
550 if(jand4)=0ande<>0thene=e-7:xp=xp-13
555 if(jand8)=0ande<>14thene=e+7:xp=xp+13
560 ifxp<>40andxp<>8thenpoke53264,0:xp=14+e/7*13
561 ifxp=40thenpoke53264,1:xp=8
562 goto435
563 rem ** filter and mod **
570 ifxp<>8then600
571 rem ** modulation **
572 ifyp=23thenyp=22
573 poke53248,13+xp*8:poke53249,34+yp*8
574 j=peek(56320):ifj=127then60
575 if(jand16)=0then634
576 if(jand1)=0thenyp=yp-1:ifyp=18thenxp=14+e/7*13:yp=15:goto560
580 if(jand2)=0andyp<>22thenyp=yp+1
585 if(jand4)=0then600
595 goto573
597 rem ** filter **
600 xp=26:poke53264,0
605 poke53248,13+xp*8:poke53249,34+yp*8
607 j=peek(56320):ifj=127then60
608 if(jand16)=0then634
610 if(jand1)=0thenyp=yp-1:ifyp=18thenxp=14+13*e/7:yp=15:goto560
615 if(jand2)=0andyp<>23thenyp=yp+1
620 if(jand8)=0thenpoke53264,1:xp=8:goto572
630 goto605
633 rem ** compute **
634 poke214,yp-2:ifyp>16then655
640 rem ** compute, voices **
645 onyp-6goto685,720,745,747,770,805,773,810,850
650 rem ** compute, filter or mod **
655 ifxp=8then675
660 rem ** compute, filter **
665 onyp-18goto880,915,960,995,997
670 rem ** compute, modulation **
675 onyp-18goto1035,1080,1081,1082
680 rem ** waveform **
685 print""
690 j=peek(56320):if(jand1)=0and(m(e+4)and128)=0thenm(e+4)=m(e+4)+16
695 if(jand2)=0and(m(e+4)and240)>16thenm(e+4)=m(e+4)-16
700 printtab(8+13*e/7)wv$(int(m(e+4)/16))"[145]":pokes+e+4,m(e+4)and254
705 ifj=127then60
710 goto690
715 rem ** pulse **
720 p=m(e+2)+m(e+3)*256:print""
724 j=peek(56320):if(jand1)=0andp<4076thenp=p+20
725 if(jand2)=0andp>19thenp=p-20
727 if(jand8)=0andp<4095thenp=p+1
730 printtab(7+13*e/7)p"[157] [145]":pokes+e+2,pand255:pokes+e+3,int(p/256)
735 ifj=127thenm(e+2)=pand255:m(e+3)=int(p/256):goto60
740 goto724
743 rem ** ring or sync **
745 print"[156]":eo=4:goto750
747 print"[156]":eo=2
750 sys50078,eo,m(e+4),e+4:m(e+4)=peek(780):pokes+e+4,m(e+4)and254
755 if(m(e+4)andeo)=0thenprinttab(8+13*e/7)"[207]ff[145]":goto760
757 printtab(8+13*e/7)"[207]n [145]"
760 goto60
765 rem ** a,s **
770 print"[150]":eo=5:goto774
773 print"[150]":eo=6
774 p=(m(e+eo)and240)/16
775 j=peek(56320):if(jand1)=0andp<>15thenp=p+1
780 if(jand2)=0andp<>0thenp=p-1
785 printtab(7+13*e/7)p"[157] [145]":pokes+e+eo,(m(e+eo)and15)+p*16
790 ifj=127thenm(e+eo)=(m(e+eo)and15)+p*16:goto60
795 goto775
800 rem ** d,r **
805 print"[150]":eo=5:goto815
810 print"[150]":eo=6
815 p=m(e+eo)and15
820 j=peek(56320):if(jand1)=0andp<>15thenp=p+1
825 if(jand2)=0andp<>0thenp=p-1
830 printtab(7+13*e/7)p"[157] [145]":pokes+e+eo,(m(e+eo)and240)+p
835 ifj=127thenm(e+eo)=(m(e+eo)and240)+p:goto60
840 goto820
845 rem ** octave **
850 print"":p=6-(log(m(e/7+25))/log(2))
855 j=peek(56320):if(jand1)=0andp<>7thenp=p+1
856 if(jand2)=0andp<>-5thenp=p-1
860 printtab(7+13*e/7)p"[145]"
865 ifj=127thenm(e/7+25)=2^(6-p):goto60
870 goto855
875 rem ** cutoff freq **
880 print"[159]":p=m(21)+m(22)*8
885 j=peek(56320):if(jand1)=0andp<2028thenp=p+20
890 if(jand2)=0andp>19thenp=p-20
893 if(jand8)=0andp<2047thenp=p+1
895 printtab(14)p"[157] [145]"
897 m(21)=pand7:m(22)=int(p/8):pokes+21,m(21):pokes+22,m(22)
900 ifj=127then60
905 goto885
910 rem ** voices **
915 printtab(15)"[159] [145]":p=m(23)and7
920 p=p+1:pokes+23,(m(23)and248)+p:ifp=8thenp=0
930 ifpand1thenprinttab(15)"[159]1[145]"
935 ifpand2thenprinttab(17)"[159]2[145]"
940 ifpand4thenprinttab(19)"[159]3[145]"
950 m(23)=(m(23)and248)+p:goto60
955 rem ** mode **
960 printtab(15)"[159] [145]":p=m(24)and112
965 p=p+16:ifp=128thenp=0
967 pokes+24,(m(24)and143)+p
970 ifpand16thenprinttab(15)"[159][204]p[145]"
975 ifpand32thenprinttab(18)"[159][194]p[145]"
980 ifpand64thenprinttab(21)"[159][200]p[145]"
985 m(24)=(m(24)and143)+p:goto60
990 rem ** resonance, volume **
995 eo=23:a=15:si=16:p=(m(eo)and240)/16:goto998
997 eo=24:a=240:s