home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 April
/
1987-04.d64
/
improvisor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
95 lines
10 nt=0:fort=0to9:readco(t),ch(t):next
20 data 1,18,8,6,4,7,2,1,14,3,5,4,12,6,9,7,5,1,6,3
30 poke53280,6:poke53281,15
40 print"[147][144]","the grand improvisor":print""," short-tunes "
50 print" type f1[146] key, and c-64 goes random.":rem flag=0 and ra=1
60 print"[151] type f3[146] key, and c-64 will compose.":rem if tune=0
70 print" type f5[146] key, and you can play along.":flag=0:rem and tune=0
80 print"[129] type f7[146] key, and you will hear tunes.":tune=1:print:rem flag=0
90 print"[154] these are the tunes which i memorized."
100 data 144,31,5,28,144,31,156,144,31,30,5,28,156,31,30,5
110 dimh1(32),l1(32),h2(32),l2(32),in(16),tunes(512)
120 print"[151]":goto330
130 rem array values for accompaniment to the improvisations
140 data0,0,0,0,5,152,11,48,14,24,22,96,4,48,8,97,14,25,22,96
150 data5,152,11,48,14,24,22,96,4,48,8,97,4,112,8,225
160 data4,180,9,104,15,210,22,96,3,35,6,71,15,210,22,96
170 data4,180,9,104,15,210,22,96,3,35,6,71,3,244,7,233
180 data4,48,8,97,14,239,21,31,3,35,6,71,14,239,21,31
190 data4,48,8,97,14,239,21,31,3,35,6,71,3,187,7,119
200 data4,48,16,195,4,180,14,239,4,251,14,24,5,71,12,143
210 data5,152,11,48,4,48,14,24,5,152,11,48,0,0,0,0
220 rem a short routine to give the c-64 a little a.i. in music composition
230 ai=int(rnd(0)*23)+1:ne=131
240 ifai>16thenon(ai-16)goto260,270,280,290,300,310,320
250 r=tu((ai*16)+p):return
260 r=0:return
270 r=2:return
280 r=3:return
290 r=5:return
300 r=7:return
310 r=8:return
320 r=0:return
330 print"[154] i am memorizing sixteen tunes now. "
340 fork=1to16:readin(k):next
350 fori=0to32:readh1(i),l1(i),h2(i),l2(i):nexti
360 fort=0to9:readh3(t),l3(t):nextt
370 fortn=1to512:readtunes(tn):next:tune=1
380 fors=1to20:poke1823+s,32:poke1863-s,32:ford=1to33:nextd:nexts
390 l1=54272:l2=54279:l3=54286
400 h1=l1+1:h2=l2+1:h3=l3+1
410 v1=l1+4:v2=l2+4:v3=l3+4
420 poke54296,12:ch=1874:co=56146
430 pokev1+1,10:pokev1+2,70
440 pokev2+1,10:pokev2+2,70
450 pokev3+1,10:pokev3+2,75:pokev3-1,8
460 p=1:rem play accompaniment and get melody note from melody array
470 q=q+1:ifq=17thenfort=1to1111:next:poke53281,7:goto930
480 print"[144] 0 1 2 3 4 5 6 7 8 9 "
490 print""
500 print"[154]"spc(7)" now playing improv."chr$(in(q))" #";q;"[157] "
510 pokev1,32:pokev2,32:pokev3,64:nt=nt+1
520 geta$:ne=150:ifa$=""thena$="5"
530 ifa$="[136]"thenflag=0:tune=1:ra=0:print"[129]"," short-tunes ":gosub920
540 ifa$="[135]"thenflag=0:tune=0:ra=0:print""," now you play. ":gosub910
550 ifa$="[134]"thenflag=1:tune=0:ra=0:print"[151]"," c-64 composes.":gosub900
560 ifa$="[133]"thenflag=0:tune=0:ra=1:print""," c-64 random. ":gosub890
570 r=val(a$):ifflagthengosub230
580 ifrathenr=int(rnd(1)*10)
590 iftunethenr=tunes(nt)
600 ifr>9thenr=0
610 pokeh1,h1(p):pokel1,l1(p):pokeh2,h2(p):pokel2,l2(p)
620 ifp=31thenr=1
630 ifp=32thenr=0
640 ifh3(r)=0goto660
650 pokeh3,h3(r):pokel3,l3(r):pokev3,65
660 pokev1,33:pokev2,33:pokech+40+(r*2),ch(r):pokeco+40+(r*2),co(r)
670 fort=1tone:next
680 pokech+40+(r*2),32:p=p+1:ifp=33thenp=1:goto470
690 a$="":goto510
700 data0,0,22,96,25,30,28,49,33,135,37,162,44,193,50,60,56,99,67,15
710 rem each line of data contains the notes for one little improv.--16 diff.
720 data4,4,0,5,6,7,8,0,7,7,0,8,7,6,5,0,4,4,0,2,4,7,9,0,9,8,7,4,6,0,1,0
730 data4,5,6,5,4,5,6,5,7,8,7,8,7,0,0,8,7,8,9,8,7,8,9,8,6,7,6,5,6,0,1,0
740 data4,4,5,4,8,8,7,6,7,8,7,6,5,0,6,5,4,9,7,9,4,9,7,0,9,9,4,4,6,0,1,0
750 data1,2,3,4,1,2,3,0,7,6,5,0,7,6,5,0,4,4,9,9,4,4,7,0,9,8,7,8,6,4,1,0
760 data4,4,3,5,4,0,3,0,7,7,6,5,7,0,5,0,4,4,2,3,4,4,4,0,9,9,8,7,8,6,1,0
770 data4,4,8,6,4,4,8,6,7,7,6,5,7,8,7,0,4,4,9,0,9,9,4,0,7,4,5,4,3,1,1,0
780 data1,2,3,4,5,6,7,8,7,0,5,0,7,6,5,0,4,9,7,9,4,0,7,0,9,7,4,5,6,0,1,0
790 data3,3,3,0,3,3,3,0,2,2,2,3,2,0,5,0,4,4,4,0,9,9,9,0,4,9,4,9,6,4,1,0
800 data3,4,5,3,4,5,4,3,2,3,2,7,2,0,5,0,4,9,4,7,9,7,4,0,9,8,7,5,6,0,1,0
810 data4,4,5,4,8,8,7,6,7,7,5,5,7,0,6,5,4,2,4,5,4,2,4,0,9,4,5,4,3,1,1,0
820 data3,0,3,2,1,0,1,0,2,3,2,5,2,3,2,0,4,4,4,9,4,4,4,0,9,8,7,4,6,6,1,0
830 data8,9,9,0,8,7,6,0,7,8,9,8,7,0,5,0,4,4,5,4,9,0,4,0,7,6,5,4,6,4,1,0
840 data5,5,4,0,5,5,4,0,3,3,2,0,3,3,2,0,4,4,7,0,4,4,9,0,4,4,5,4,3,1,1,0
850 data1,3,4,5,6,5,4,3,2,3,2,0,7,8,7,0,4,5,4,9,4,5,4,0,8,7,6,5,6,0,1,0
860 data9,8,7,6,5,4,3,4,2,3,4,5,7,6,5,0,9,4,4,5,4,9,4,0,9,8,7,4,6,6,1,0
870 data4,5,4,6,4,5,4,0,2,3,2,5,2,3,2,0,4,5,4,7,4,4,4,0,9,8,7,4,5,6,1,0
880 rem instructions for each function
890 print" note sequences using a random function.":return
900 print"[151] the c-64's a. i. in music composition. ":return
910 print" numbers for notes - letters for rests. ":return
920 print"[154] these are the tunes which i memorized. ":return
930 print"[147]that's all the grand improvisor"
940 print"will play for now."