-
Notifications
You must be signed in to change notification settings - Fork 1
/
et_tunings.py
197 lines (173 loc) · 8.01 KB
/
et_tunings.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
################## Scales and tuning names can be researched on https://en.xen.wiki/ ##################
################## Equal Temperament tunings (select a class) ##################
################## "ET" or "Equal Temperament" can also be defined as "EDO" or "Equal Division of Octive"
# abstract class for distributing names method
class Tunings:
@classmethod
def library(cls):
lib = []
for items in (cls.__class__.__dict__.items(), cls.__dict__.items()):
lib.extend([(key, value) for key, value in items if isinstance(value, (Pattern))])
return dict(lib)
@classmethod
def names(cls):
return sorted(cls.library().keys())
# global method to return cumulative sum
@classmethod
def cumulative(cls, exp):
if (isinstance(exp, Pattern)):
for index in range(len(exp)):
if index != 0:
exp[index] = exp[index-1]+exp[index]
return exp
else:
return exp
class ET10(Tunings):
tuning = PRange(11)*12/10
chromatic = PRange(11)
minor = P[0,2,3,4,6,7,8]
mos26 = Tunings.cumulative(P[0,2,1,1,1,2,1,1])
mos17 = Tunings.cumulative(P[0,3,1,1,1,1,1,1])
mos18 = Tunings.cumulative(P[0,2,1,1,1,1,1,1,1])
class ET11(Tunings):
tuning = PRange(12)*12/11
chromatic = PRange(12)
machine5 = Tunings.cumulative(P[0,2,2,2,2])
machine6 = Tunings.cumulative(P[0,2,2,2,2,2])
orgone7 = Tunings.cumulative(P[0,1,2,1,2,1,2])
mavilaC = Tunings.cumulative(P[0,1,1,1,3,1,1])
mavilaD = Tunings.cumulative(P[0,1,1,3,1,1,3])
mavilaE = Tunings.cumulative(P[0,1,3,1,1,3,1])
mavilaF = Tunings.cumulative(P[0,3,1,1,3,1,1])
mavilaG = Tunings.cumulative(P[0,1,1,3,1,1,1])
mavilaA = Tunings.cumulative(P[0,1,3,1,1,1,3])
mavilaB = Tunings.cumulative(P[0,3,1,1,1,3,1])
classicPenta = Tunings.cumulative(P[0,1,4,1,4])
swoon = Tunings.cumulative(P[0,2,3,1,3])
class ET14(Tunings):
tuning = PRange(15)*12/14
chromatic = PRange(15)
major = P[0,2,4,6,9,11,133]
mos21 = Tunings.cumulative(P[0,5,4])
mos32 = Tunings.cumulative(P[0,4,1,4,1])
mos41 = Tunings.cumulative(P[0,3,3,2,3])
mos42 = Tunings.cumulative(P[0,3,1,3,3,1])
modmos24 = Tunings.cumulative(P[0,3,2,2,2,2])
modmos42 = Tunings.cumulative(P[0,3,1,3,1,3])
mos62 = Tunings.cumulative(P[0,2,2,1,2,2,2,1])
modmos62 = Tunings.cumulative(P[0,2,1,2,2,2,2,1])
mos54 = Tunings.cumulative(P[0,2,1,2,1,2,1,2,1])
mos46 = Tunings.cumulative(P[0,1,2,1,2,1,1,2,1,2])
mos38 = Tunings.cumulative(P[0,1,2,1,1,1,2,1,1,1,2])
mos210 = Tunings.cumulative(P[0,1,1,2,1,1,1,1,1,2,1,1])
mos111 = Tunings.cumulative(P[0,1,1,1,1,1,3,1,1,1,1,1])
mos112 = Tunings.cumulative(P[0,1,1,1,1,1,1,2,1,1,1,1,1])
class ET17(Tunings):
tuning = PRange(18)*12/17
chromatic = PRange(18)
otonal = P[0,3,5,8,10,12,14]
neutral = P[0,2,5,7,10,12,15]
bleu7 = Tunings.cumulative(P[0,5,2,2,2,2,2])
machine6 = Tunings.cumulative(P[0,2,3,3,3,3])
huxley9 = Tunings.cumulative(P[0,1,1,3,1,3,1,3,1])
maqamic7 = Tunings.cumulative(P[0,2,2,3,2,3,2])
sqwares8 = Tunings.cumulative(P[0,4,1,4,1,1,4,1,1])
supra7 = Tunings.cumulative(P[0,3,3,3,1,3,3])
progress7 = Tunings.cumulative(P[0,1,1,1,6,1,1])
class ET18(Tunings):
tuning = PRange(19)*12/18
chromatic = PRange(19)
minor = P[0,3,5,8,11,13,15]
major = P[0,3,6,8,11,14,17]
mos43 = Tunings.cumulative(P[0,3,2,3,2,3,3])
class ET20(Tunings):
tuning = PRange(21)*12/20
chromatic = PRange(21)
blackwood10Major = Tunings.cumulative(P[0,3,1,3,1,3,1,3,1,3])
blackwood10Minor = Tunings.cumulative(P[0,1,3,1,3,1,3,1,3,1])
balzano9 = Tunings.cumulative(P[0,2,3,2,2,2,3,2,2])
balzano11 = Tunings.cumulative(P[0,2,2,2,2,1,2,2,2,2,2])
balzano9Inverse = Tunings.cumulative(P[0,2,2,2,3,2,2,2,3])
balzano11Inverse = Tunings.cumulative(P[0,1,2,2,2,2,2,1,2,2,2])
octatonic = Tunings.cumulative(P[0,2,3,2,3,2,3,2])
diminished = Tunings.cumulative(P[0,3,2,3,2,3,2,3])
major = Tunings.cumulative(P[0,4,3,1,4,3,4])
minor = Tunings.cumulative(P[0,4,1,3,4,1,4])
chromatic12 = Tunings.cumulative(P[0,2,2,1,2,1,2,2,1,2,2,2])
zweifelMajor = Tunings.cumulative(P[0,2,2,2,2,1,2,2,2,2,1])
zweifelMinor = Tunings.cumulative(P[0,2,1,2,2,2,2,2,1,2,2])
majorQuasi = Tunings.cumulative(P[0,3,3,3,3,3,3])
minorQuasi = Tunings.cumulative(P[0,3,2,3,3,3,3])
rotenberg = Tunings.cumulative(P[0,3,2,2,2,2,3,2,2])
stearnsMajor = Tunings.cumulative(P[0,3,4,1,4,3,3])
pentatonic = Tunings.cumulative(P[0,7,2,7,2])
antiDiatonic = Tunings.cumulative(P[0,5,2,2,5,2,2])
class ET22(Tunings):
tuning = PRange(23)*12/22
chromatic = PRange(23)
porcupine7 = Tunings.cumulative(P[0,3,3,3,4,3,3])
orwell5 = Tunings.cumulative(P[0,5,5,2,5])
orwell9 = Tunings.cumulative(P[0,2,3,2,3,2,3,2,3])
magic7 = Tunings.cumulative(P[0,1,6,1,6,1,6])
superpyth5 = Tunings.cumulative(P[0,4,5,4,5])
superpyth7 = Tunings.cumulative(P[0,4,1,4,4,4,1])
hedgehog6 = Tunings.cumulative(P[0,3,5,3,3,5])
astrology6 = Tunings.cumulative(P[0,4,3,4,4,3])
doublewide6 = Tunings.cumulative(P[0,5,5,1,5,5])
zarlinoJustMaj = Tunings.cumulative(P[0,4,3,2,4,3,4])
zarlinoMinor = Tunings.cumulative(P[0,4,2,3,4,2,4])
tetraChordMaj = Tunings.cumulative(P[0,4,3,2,4,4,3])
tetraChordMin = Tunings.cumulative(P[0,4,2,3,4,2,3])
justMaj5 = Tunings.cumulative(P[0,4,3,6,3])
justMin5 = Tunings.cumulative(P[0,6,3,4,6])
porcuBrightMaj = Tunings.cumulative(P[0,4,3,3,3,3,4])
porcuBrightMin = Tunings.cumulative(P[0,4,2,4,3,3,3])
porcuDarkMin = Tunings.cumulative(P[0,4,2,3,4,3,3])
marvelDoubleHMaj = Tunings.cumulative(P[0,2,5,2,4,2,5])
marvel6 = Tunings.cumulative(P[0,5,2,6,2,5])
class ET23(Tunings):
tuning = PRange(24)*12/22
chromatic = PRange(24)
keter = Tunings.cumulative(P[0,2,2,2,3,2,2,3,2,2])
chesed = Tunings.cumulative(P[0,2,2,3,2,2,3,2,2,3])
netzach = Tunings.cumulative(P[0,2,3,2,2,3,2,2,3,2])
malkuth = Tunings.cumulative(P[0,3,2,2,3,2,2,3,2,2])
binah = Tunings.cumulative(P[0,2,2,3,2,2,3,2,2,2])
tiferet = Tunings.cumulative(P[0,2,3,2,2,3,2,2,2,3])
yesod = Tunings.cumulative(P[0,3,2,2,3,2,2,2,3,2])
chokmah = Tunings.cumulative(P[0,2,2,3,2,2,2,3,2,2])
gevurah = Tunings.cumulative(P[0,2,3,2,2,2,3,2,2,3])
hod = Tunings.cumulative(P[0,3,2,2,2,3,2,2,3,2])
class ET24(Tunings):
tuning = PRange(25)*12/24
chromatic = PRange(25)
makam_segah = Tunings.cumulative(P[0,3,4,4,3,3,4])
makam_huzzam = Tunings.cumulative(P[0,3,4,2,6,2,4])
makam_hicazkar = Tunings.cumulative(P[0,2,5,3,4,2,5])
makam_mahur = Tunings.cumulative(P[0,4,3,3,4,4,4])
makam_rast = Tunings.cumulative(P[0,4,3,3,4,4,3])
makam_ussak = Tunings.cumulative(P[0,3,3,4,4,2,4])
class ET36(Tunings):
tuning = PRange(37)*12/36
chromatic = PRange(37)
# non-octive based tunings must include a redifinition of our interval range. For example, re-creating the Boehlen-Pierce scale goes like:
class BoehlenPierceII:
tuningfreq = 3**(PRange(14)/13)
tuning=[]
for i in tuningfreq:
tuning.append(math.log(i,2)*12)
chromatic = PRange(14)
# as you see, we need to redigine our intervals first, then convert them to cents.
# Now let us go with a nice tunings discovered by James Mulvale, the Sweetie
class Sweetie(Tunings):
tuningfreq = (23/16)**(PRange(9)/8)
tuning=[]
for i in tuningfreq:
tuning.append(math.log(i,2)*12)
chromatic = PRange(9)
#the Sweetie generates nice, warm-sounding notes. It is the division in 8 disting pitches, of the ratio 23/16, as opposed to the octave, which is 2/1; or the tritave, which is 3/1.
# application example
print(ET17.names())
Scale.default.set(ET17.otonal,tuning=ET17.tuning)
################## Equal temparent other than octave tunings w/ scales, these are not EDOs since our reference space is not an octive ##################
Scale.default.set(Scale.major, tuning=Tuning.bohlen_pierce)