home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1987 April / 1987-04.d64 / improvisor (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  95 lines

  1. 10 nt=0:fort=0to9:readco(t),ch(t):next
  2. 20 data 1,18,8,6,4,7,2,1,14,3,5,4,12,6,9,7,5,1,6,3
  3. 30 poke53280,6:poke53281,15
  4. 40 print"[147][144]","the grand improvisor":print"","    short-tunes "
  5. 50 print"  type f1[146] key, and c-64 goes random.":rem flag=0 and ra=1
  6. 60 print"[151]  type f3[146] key, and c-64 will compose.":rem if tune=0
  7. 70 print"  type f5[146] key, and you can play along.":flag=0:rem and tune=0
  8. 80 print"[129]  type f7[146] key, and you will hear tunes.":tune=1:print:rem flag=0
  9. 90 print"[154] these are the tunes which i memorized."
  10. 100 data 144,31,5,28,144,31,156,144,31,30,5,28,156,31,30,5
  11. 110 dimh1(32),l1(32),h2(32),l2(32),in(16),tunes(512)
  12. 120 print"[151]":goto330
  13. 130 rem array values for accompaniment to the improvisations
  14. 140 data0,0,0,0,5,152,11,48,14,24,22,96,4,48,8,97,14,25,22,96
  15. 150 data5,152,11,48,14,24,22,96,4,48,8,97,4,112,8,225
  16. 160 data4,180,9,104,15,210,22,96,3,35,6,71,15,210,22,96
  17. 170 data4,180,9,104,15,210,22,96,3,35,6,71,3,244,7,233
  18. 180 data4,48,8,97,14,239,21,31,3,35,6,71,14,239,21,31
  19. 190 data4,48,8,97,14,239,21,31,3,35,6,71,3,187,7,119
  20. 200 data4,48,16,195,4,180,14,239,4,251,14,24,5,71,12,143
  21. 210 data5,152,11,48,4,48,14,24,5,152,11,48,0,0,0,0
  22. 220 rem a short routine to give the c-64 a little a.i. in music composition
  23. 230 ai=int(rnd(0)*23)+1:ne=131
  24. 240 ifai>16thenon(ai-16)goto260,270,280,290,300,310,320
  25. 250 r=tu((ai*16)+p):return
  26. 260 r=0:return
  27. 270 r=2:return
  28. 280 r=3:return
  29. 290 r=5:return
  30. 300 r=7:return
  31. 310 r=8:return
  32. 320 r=0:return
  33. 330 print"[154] i am memorizing sixteen tunes now. "
  34. 340 fork=1to16:readin(k):next
  35. 350 fori=0to32:readh1(i),l1(i),h2(i),l2(i):nexti
  36. 360 fort=0to9:readh3(t),l3(t):nextt
  37. 370 fortn=1to512:readtunes(tn):next:tune=1
  38. 380 fors=1to20:poke1823+s,32:poke1863-s,32:ford=1to33:nextd:nexts
  39. 390 l1=54272:l2=54279:l3=54286
  40. 400 h1=l1+1:h2=l2+1:h3=l3+1
  41. 410 v1=l1+4:v2=l2+4:v3=l3+4
  42. 420 poke54296,12:ch=1874:co=56146
  43. 430 pokev1+1,10:pokev1+2,70
  44. 440 pokev2+1,10:pokev2+2,70
  45. 450 pokev3+1,10:pokev3+2,75:pokev3-1,8
  46. 460 p=1:rem play accompaniment and get melody note from melody array
  47. 470 q=q+1:ifq=17thenfort=1to1111:next:poke53281,7:goto930
  48. 480 print"[144]          0 1 2 3 4 5 6 7 8 9 "
  49. 490 print""
  50. 500 print"[154]"spc(7)" now playing improv."chr$(in(q))" #";q;"[157] "
  51. 510 pokev1,32:pokev2,32:pokev3,64:nt=nt+1
  52. 520 geta$:ne=150:ifa$=""thena$="5"
  53. 530 ifa$="[136]"thenflag=0:tune=1:ra=0:print"[129]","    short-tunes  ":gosub920
  54. 540 ifa$="[135]"thenflag=0:tune=0:ra=0:print"","   now you play. ":gosub910
  55. 550 ifa$="[134]"thenflag=1:tune=0:ra=0:print"[151]","   c-64 composes.":gosub900
  56. 560 ifa$="[133]"thenflag=0:tune=0:ra=1:print"","   c-64  random. ":gosub890
  57. 570 r=val(a$):ifflagthengosub230
  58. 580 ifrathenr=int(rnd(1)*10)
  59. 590 iftunethenr=tunes(nt)
  60. 600 ifr>9thenr=0
  61. 610 pokeh1,h1(p):pokel1,l1(p):pokeh2,h2(p):pokel2,l2(p)
  62. 620 ifp=31thenr=1
  63. 630 ifp=32thenr=0
  64. 640 ifh3(r)=0goto660
  65. 650 pokeh3,h3(r):pokel3,l3(r):pokev3,65
  66. 660 pokev1,33:pokev2,33:pokech+40+(r*2),ch(r):pokeco+40+(r*2),co(r)
  67. 670 fort=1tone:next
  68. 680 pokech+40+(r*2),32:p=p+1:ifp=33thenp=1:goto470
  69. 690 a$="":goto510
  70. 700 data0,0,22,96,25,30,28,49,33,135,37,162,44,193,50,60,56,99,67,15
  71. 710 rem each line of data contains the notes for one little improv.--16 diff.
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. 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
  82. 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
  83. 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
  84. 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
  85. 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
  86. 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
  87. 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
  88. 880 rem instructions for each function
  89. 890 print" note sequences using a random function.":return
  90. 900 print"[151] the c-64's a. i. in music composition. ":return
  91. 910 print" numbers for notes - letters for rests. ":return
  92. 920 print"[154] these are the tunes which i memorized. ":return
  93. 930 print"[147]that's all the grand improvisor"
  94. 940 print"will play for now."
  95.