Spaces:
Running
Running
asigalov61
commited on
Commit
•
ddf16bf
1
Parent(s):
b9703ed
Update app.py
Browse files
app.py
CHANGED
@@ -120,7 +120,27 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, mel
|
|
120 |
for e in output_score:
|
121 |
if e[3] != 9:
|
122 |
e[4] = 127 - e[4]
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
print('Done processing!')
|
125 |
print('=' * 70)
|
126 |
|
@@ -247,7 +267,7 @@ if __name__ == "__main__":
|
|
247 |
|
248 |
gr.Markdown("## Select desired render type")
|
249 |
|
250 |
-
render_type = gr.Radio(["Render as-is", "Extract melody", "Transform"], label="Render type", value="Render as-is")
|
251 |
|
252 |
gr.Markdown("## Select desired render options")
|
253 |
|
|
|
120 |
for e in output_score:
|
121 |
if e[3] != 9:
|
122 |
e[4] = 127 - e[4]
|
123 |
+
|
124 |
+
elif render_type == 'Repair':
|
125 |
+
output_score = []
|
126 |
+
|
127 |
+
for c in cscore:
|
128 |
+
tones_chord = sorted(set([t[4] % 12 for t in c if t[3] != 9]))
|
129 |
+
drums_events = [t for t in c if t[3] == 9]
|
130 |
+
|
131 |
+
new_tones_chord = TMIDIX.check_and_fix_tones_chord(tones_chord)
|
132 |
+
|
133 |
+
if tones_chord:
|
134 |
+
if len(c) > 1:
|
135 |
+
output_score.extend([c[0]])
|
136 |
+
for cc in c[1:]
|
137 |
+
if cc[3] != 9 and (cc[4] % 12) in new_tones_chord:
|
138 |
+
output_score.extend([cc])
|
139 |
+
output_score.extend(drums_events)
|
140 |
+
else:
|
141 |
+
|
142 |
+
output_score.extend([c[0]] + drums_events)
|
143 |
+
|
144 |
print('Done processing!')
|
145 |
print('=' * 70)
|
146 |
|
|
|
267 |
|
268 |
gr.Markdown("## Select desired render type")
|
269 |
|
270 |
+
render_type = gr.Radio(["Render as-is", "Extract melody", "Transform", "Repair"], label="Render type", value="Render as-is")
|
271 |
|
272 |
gr.Markdown("## Select desired render options")
|
273 |
|