-
Notifications
You must be signed in to change notification settings - Fork 0
/
jute_song.py
148 lines (117 loc) · 3.38 KB
/
jute_song.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
import json, shutil
from housepy import log
phrases = [
"d'2",
"d''2",
"g'4 g'4",
"b'4 b'4",
"d'4 e'4",
"d'4 e'8. g'16",
"d'4. b'8",
"g'4~ g'8. b'16",
"g'8 b'4.",
"c''4. d''8",
"d''4. e''8",
"d'4. b8",
"d'4. c'8",
"e'4 d'4",
"a'8 g'4.",
"c''4 b'4",
"d''8 b'4.",
"d''4 c''4",
"d''8 c''4.",
"d'4 d'16 g'8.",
"g'8 a'4 b'8",
"e'4 a'8 g'8",
"a'8 b'8 g'4",
"b'4 a'8 g'8",
"e'8 d'4 d''8",
"e'16 e'8. a'8 g'8",
"c''16 c''8. b'8 a'8",
"d''8 d''8 d''8 e''8",
"d''8 d''8 d''8 a'8",
"c''8 b'8 a'8 g'8",
"c''8 b'8 g'8 e'8",
"b'8 a'8 g'8 e'8",
"b'8 a'8 g'8 d'8",
"b'8 a'8 g'8 a'8",
"c''8 c''8 b'8 a'8",
]
if __name__ == "__main__":
material = [ "d'4 e'4",
"d'4. c'8",
"d'4 d'16 g'8.",
"g'4~ g'8. b'16",
"c''4 b'4",
"a'8 g'4.",
"b'8 a'8 g'8 e'8",
"d'2",
"d''4. e''8",
"d''4 c''4",
"b'8 a'8 g'8 e'8",
"c''4. d''8",
"b'8 a'8 g'8 d'8",
"e'4 a'8 g'8",
"e'4 d'4",
"d'2",
"d'4 e'4",
"d'4. b'8",
"c''8 b'8 g'8 e'8",
"d'2",
"c''16 c''8. b'8 a'8",
"b'8 a'8 g'8 a'8",
"b'8 a'8 g'8 e'8",
"d'2",
"d''8 d''8 d''8 e''8",
"d''8 c''4.",
"b'4 a'8 g'8",
"c''4. d''8",
"b'8 a'8 g'8 d'8",
"e'16 e'8. a'8 g'8",
"e'4 d'4",
"d'2",
"d'4 e'4",
"d'4. b8",
"d'4 e'8. g'16",
"g'8 b'4.",
"c''8 c''8 b'8 a'8",
"g'8 a'4 b'8",
"c''8 b'8 a'8 g'8",
"e'8 d'4 d''8",
"d''8 d''8 d''8 e''8",
"d''8 b'4.",
"b'4 a'8 g'8",
"c''4. d''8",
"b'8 a'8 g'8 d'8",
"e'16 e'8. a'8 g'8",
"e'4 d'4",
"d'2",
"a'8 b'8 g'4",
"d''8 d''8 d''8 a'8",
"g'4 g'4",
"b'4 b'4",
"d''2",
]
def purge_dups(material):
dups = []
for phrase in material:
matches = []
for p, phrase_ in enumerate(material):
if phrase == phrase_:
matches.append(p)
dups.extend(matches[1:])
material = [phrase for (p, phrase) in enumerate(material) if (p not in dups)]
if len(material) < 32:
log.warning("WARNING: insufficient encoder length (%s)" % len(material))
return material
material = purge_dups(material)
print(json.dumps(material, indent=4))
for p, phrase in enumerate(material):
print("%s -> %s" % (p, phrases.index(phrase)))
p1 = str(p)
if len(p1) < 2:
p1 = "0%s" % p1
p2 = str(phrases.index(phrase))
if len(p2) < 2:
p2 = "0%s" % p2
shutil.copy("phrases/original/%s.png" % p1, "phrases/%s.png" % p2)