-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathedo_chart.dc
53 lines (46 loc) · 1013 Bytes
/
edo_chart.dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"
This script will compare some prime numbered EDOs (equal divisions of the
octave) to compare how close or off the EDO's nearest estimation to a
perfect 5th (3/2 ratio) is.
" print
# load some primes
5 0 !
7 1 !
11 2 !
13 3 !
17 4 !
19 5 !
23 6 !
29 7 !
31 8 !
37 9 !
41 10 !
43 11 !
47 12 !
53 13 !
# perfect 5th to compare, store in slot 14:
3 2 / log2 14 !
: fifth 14 ;
: degree 15 ;
: fifth-cents 16 ;
: diff 17 ;
"
perfect 5th is: " print
fifth @ 1200 * 7 6 .rj "cents" print cr cr
# print table header:
" edo | deg | cents for 3/2 | error " print cr
"---------------------------------------" print cr
# loop through data
: main
13 times
i @ 4 3 .rj "\bedo" print # edo
fifth @ i @ * round dup degree ! 3 3 .rj # degree
"\bdeg" print
degree @ i @ / 1200 * dup fifth-cents ! 12 6 .rj # cents value of 5th
fifth-cents @ fifth @ 1200 * - 12 6 .rj cr # difference from pure
again
;
# run program
main
# final carriage return:
cr