-
Notifications
You must be signed in to change notification settings - Fork 0
/
pitches.py
120 lines (113 loc) · 1.96 KB
/
pitches.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
import json
class Pitches():
def __init__(self):
self.pitches = PITCHES
def values(self):
return self.pitches.values()
def get_pitch_index(self, val):
for k, v in self.pitches.items():
if v == val:
return int(k)
return None
def get_pitch_value(self, key):
return self.pitches[key]
def get_next_pitch(self, val):
i = self.get_pitch_index(val)
if i is not None and i < len(self.pitches):
i += 1
return self.pitches[str(i)]
def get_previous_pitch(self, val):
i = self.get_pitch_index(val)
if i is not None and i > 0:
i -= 1
return self.pitches[str(i)]
PITCHES = {
"1": "LA0",
"2": "LA#0",
"3": "SI0",
"4": "DO1",
"5": "DO#1",
"6": "RE1",
"7": "RE#1",
"8": "MI1",
"9": "FA1",
"10": "FA#1",
"11": "SOL1",
"12": "SOL#1",
"13": "LA1",
"14": "LA#1",
"15": "SI1",
"16": "DO2",
"17": "DO#2",
"18": "RE2",
"19": "RE#2",
"20": "MI2",
"21": "FA2",
"22": "FA#2",
"23": "SOL2",
"24": "SOL#2",
"25": "LA2",
"26": "LA#2",
"27": "SI2",
"28": "DO3",
"29": "DO#3",
"30": "RE3",
"31": "RE#3",
"32": "MI3",
"33": "FA3",
"34": "FA#3",
"35": "SOL3",
"36": "SOL#3",
"37": "LA3",
"38": "LA#3",
"39": "SI3",
"40": "DO4",
"41": "DO#4",
"42": "RE4",
"43": "RE#4",
"44": "MI4",
"45": "FA4",
"46": "FA#4",
"47": "SOL4",
"48": "SOL#4",
"49": "LA4",
"50": "LA#4",
"51": "SI4",
"52": "DO5",
"53": "DO#5",
"54": "RE5",
"55": "RE#5",
"56": "MI5",
"57": "FA5",
"58": "FA#5",
"59": "SOL5",
"60": "SOL#5",
"61": "LA5",
"62": "LA#5",
"63": "SI5",
"64": "DO6",
"65": "DO#6",
"66": "RE6",
"67": "RE#6",
"68": "MI6",
"69": "FA6",
"70": "FA#6",
"71": "SOL6",
"72": "SOL#6",
"73": "LA6",
"74": "LA#6",
"75": "SI6",
"76": "DO7",
"77": "DO#7",
"78": "RE7",
"79": "RE#7",
"80": "MI7",
"81": "FA7",
"82": "FA#7",
"83": "SOL7",
"84": "SOL#7",
"85": "LA7",
"86": "LA#7",
"87": "SI7",
"88": "DO8"
}