asigalov61
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,8 @@ def render_midi(input_midi,
|
|
26 |
render_sample_rate,
|
27 |
custom_render_patch,
|
28 |
render_transpose_value,
|
29 |
-
render_transpose_to_C4
|
|
|
30 |
):
|
31 |
|
32 |
print('*' * 70)
|
@@ -51,7 +52,7 @@ def render_midi(input_midi,
|
|
51 |
print('Custom MIDI render patch', custom_render_patch)
|
52 |
print('Transpose value:', render_transpose_value)
|
53 |
print('Transpose to C4', render_transpose_to_C4)
|
54 |
-
|
55 |
print('=' * 70)
|
56 |
print('Processing MIDI...Please wait...')
|
57 |
|
@@ -122,6 +123,15 @@ def render_midi(input_midi,
|
|
122 |
|
123 |
if render_transpose_to_C4:
|
124 |
output_score = TMIDIX.transpose_escore_notes_to_pitch(output_score)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
|
127 |
|
@@ -237,6 +247,7 @@ if __name__ == "__main__":
|
|
237 |
|
238 |
render_transpose_value = gr.Slider(-12, 12, value=0, step=1, label="Transpose value")
|
239 |
render_transpose_to_C4 = gr.Checkbox(label="Transpose to C4", value=False)
|
|
|
240 |
|
241 |
submit = gr.Button()
|
242 |
|
@@ -255,7 +266,8 @@ if __name__ == "__main__":
|
|
255 |
render_sample_rate,
|
256 |
custom_render_patch,
|
257 |
render_transpose_value,
|
258 |
-
render_transpose_to_C4
|
|
|
259 |
],
|
260 |
[output_midi_md5, output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
261 |
|
|
|
26 |
render_sample_rate,
|
27 |
custom_render_patch,
|
28 |
render_transpose_value,
|
29 |
+
render_transpose_to_C4,
|
30 |
+
render_align
|
31 |
):
|
32 |
|
33 |
print('*' * 70)
|
|
|
52 |
print('Custom MIDI render patch', custom_render_patch)
|
53 |
print('Transpose value:', render_transpose_value)
|
54 |
print('Transpose to C4', render_transpose_to_C4)
|
55 |
+
print('Align to bars:', render_align)
|
56 |
print('=' * 70)
|
57 |
print('Processing MIDI...Please wait...')
|
58 |
|
|
|
123 |
|
124 |
if render_transpose_to_C4:
|
125 |
output_score = TMIDIX.transpose_escore_notes_to_pitch(output_score)
|
126 |
+
|
127 |
+
if render_align == "Start Times":
|
128 |
+
output_score = TMIDIX.align_escore_notes_to_bars(output_score)
|
129 |
+
|
130 |
+
elif render_align == "Start Times and Durations":
|
131 |
+
output_score = TMIDIX.align_escore_notes_to_bars(output_score, trim_durations=True)
|
132 |
+
|
133 |
+
elif render_align == "Start Times and Split Durations":
|
134 |
+
output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
|
135 |
|
136 |
SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
|
137 |
|
|
|
247 |
|
248 |
render_transpose_value = gr.Slider(-12, 12, value=0, step=1, label="Transpose value")
|
249 |
render_transpose_to_C4 = gr.Checkbox(label="Transpose to C4", value=False)
|
250 |
+
render_align = gr.Radio(["Do not align", "Start Times", "Start Times and Durations", "Start Times and Split Durations"], label="Align output to bars", value="Do not align")
|
251 |
|
252 |
submit = gr.Button()
|
253 |
|
|
|
266 |
render_sample_rate,
|
267 |
custom_render_patch,
|
268 |
render_transpose_value,
|
269 |
+
render_transpose_to_C4,
|
270 |
+
render_align
|
271 |
],
|
272 |
[output_midi_md5, output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
273 |
|