home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 10
/
010.d81
/
scales
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
3KB
|
112 lines
10 rem program name scales
20 rem david r. brooks, july 84
30 rem calculates sid poke values for
40 rem highest octave for equal, just
50 rem and meantone temperament
60 poke53280,0:poke53281,0:printchr$(14)
70 def fn r(x)=int(x*100+.5)/100
80 dim e(13),j(13),m(13),er(13),jr(13),mr(13),n$(6),pn$(23),c(3)
90 fori=1to23:readpn$(i):next
100 data"[193]","[194]b","[194]","[195]","[195]#","[196]","[197]b","[197]","[198]","[198]#","[199]","[199]#","[193]","[194]b","[194]"
110 data"[195]","[195]#","[196]","[197]b","[197]","[198]","[198]#","[199]"
120 rem equal temperament ratios
130 f=2^(1/12)
140 fori=0to12:er(i+1)=f^i:next
150 rem just ratios
160 c1=16/15:jr(1)=1:rem c
170 jr(2)=9/8/c1:rem c#
180 jr(3)=9/8:rem d
190 jr(4)=9/8*c1:rem e flat
200 jr(5)=5/4:rem e
210 jr(6)=4/3:rem f
220 jr(7)=3/2/c1:rem f#
230 jr(8)=3/2:rem g
240 jr(9)=5/3/c1:rem g#
250 jr(10)=5/3:rem a
260 jr(11)=5/3*c1
270 jr(12)=15/8:rem b
280 jr(13)=2:rem c
290 rem mean tone ratios
300 c2=sqr(81/80):c3=sqr(c2):mr(1)=1:rem c
310 mr(2)=25/24*c3:rem c#
320 mr(3)=9/8/c2:rem d
330 mr(4)=6/5/c3:rem e flat
340 mr(5)=5/4:rem e
350 mr(6)=4/3*c3:rem f
360 mr(7)=45/32/c2:rem f#
370 mr(8)=3/2/c3:rem g
380 mr(9)=25/16:rem g#
390 mr(10)=5/3*c3:rem a
400 mr(11)=9/5/c2:rem b flat
410 mr(12)=15/8/c3:rem b
420 mr(13)=2:rem c
430 n$(1)="[193]":n$(2)="[194]b":n$(3)="[195]":n$(4)="[196]":n$(5)="[198]":n$(6)="[199]"
440 nx(1)=0:nx(2)=1:nx(3)=3:nx(4)=5:nx(5)=8:nx(6)=10
450 print"[147][215]hat note would you like to start on?"
460 print"[193]llowed values are [195], [196], [198], [199], [193], [194]b"
470 inputns$
480 fori=1to6:ifns$=n$(i)orasc(ns$)+128=asc(n$(i))thens=nx(i):goto510
490 next
500 print"[206]ote input error. [212]ry again...":goto450
510 print"[147] [195]hoose frequency of starting note:"
520 print"1 - equally tempered value"
530 print"2 - retain [193]440"
540 c(1)=220*f^s:af=220
550 getz$:ifz$=""then550
555 ifz$<>"1"andz$<>"2"then550
560 c(2)=c(1):c(3)=c(2)
570 ifz$="1"then640
580 ifs=3thenc(2)=3/5*2*af:c(3)=3/5/c3*2*af:goto640
590 ifs=5thenc(2)=2/3*2*af:c(3)=2/3*c3*2*af:goto640
600 ifs=8thenc(2)=4/5*2*af:c(3)=4/5*2*af:goto640
610 ifs=10thenc(2)=8/9*2*af:c(3)=8/9*c2*2*af:goto640
620 ifs=0thenc(2)=af:c(3)=af:goto640
630 ifs=1thenc(2)=8/15*440:c(3)=8/15*c3*440
640 print"[147] [211]cale temperament:"
650 print"[206]ote [197]qual [202]ust [205]eantone"
660 print"--------------------------------"
670 fori=13to1step-1
680 e(i)=c(1)*er(i)
690 j(i)=c(2)*jr(i)
700 m(i)=c(3)*mr(i)
710 printpn$(i+s);tab(5);fnr(e(i));tab(14);fnr(j(i));tab(23);fnr(m(i))
720 next
730 print"[193]nother scale (y/n)?"
740 getz$:ifz$=""then740
750 ifz$="y"goto450
760 print"[195]alculate [211][201][196] [208][207][203][197] values (y/n)?"
770 getz$:ifz$=""then770
780 ifz$<>"y"thenprint"[197]nd program":goto60000
790 print"[147] [211][201][196] [208][207][203][197] values"
800 dimoc$(12)
810 c=.06095977
820 oc$(1)=" [195]-7":oc$(2)="[195]#-7":oc$(3)=" [196]-7":oc$(4)="[196]#-7":oc$(5)=" [197]-7"
830 oc$(6)=" [198]-7":oc$(7)="[198]#-7":oc$(8)=" [199]-7":oc$(9)="[199]#-7":oc$(10)=" [193]-7"
840 oc$(11)="[193]#-7":oc$(12)=" [194]-7"
850 c1=8:c2=16
860 ifs=0thenl=4
870 ifs=1thenl=3
880 ifs=3thenl=1
890 ifs=5thenl=11:c1=4:c2=8
900 ifs=8thenl=8:c1=4:c2=8
910 ifs=10thenl=6:c1=4:c2=8
920 j=0
930 print" [206]ote [197]qual [202]ust [205]eantone"
940 print" ---------------------------"
950 fori=lto12:de=e(i)/c*c1:dj=j(i)/c*c1:dm=m(i)/c*c1
960 j=j+1
970 print" "oc$(j);int(de);int(dj);int(dm):next
980 ifl=1then1020
990 fori=1tol-1:de=e(i)/c*c2:dj=j(i)/c*c2:dm=m(i)/c*c2
1000 j=j+1
1010 print" "oc$(j);int(de);int(dj);int(dm):next
1020 printspc(12)"<press a key>":poke198,0:wait198,1
1030 :
60000 print"[147][215]ould you like to try another?"
60010 poke198,0:wait198,1:getk$:ifk$<>"y"andk$<>"n"thenpoke53281,rnd(1)*15:goto60010
60020 ifk$="y"then run
60030 :
63000 rem connect back to loadstar
63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
63020 poke631,13:poke632,13:poke198,2:end