asigalov61
commited on
Commit
•
c2b2970
1
Parent(s):
d62f549
Update app.py
Browse files
app.py
CHANGED
@@ -122,6 +122,7 @@ def Mix_Melody(input_midi,
|
|
122 |
input_find_best_match,
|
123 |
input_adjust_melody_notes_durations,
|
124 |
input_adjust_accompaniment_notes_durations,
|
|
|
125 |
input_output_as_solo_piano,
|
126 |
input_remove_drums
|
127 |
):
|
@@ -158,6 +159,8 @@ def Mix_Melody(input_midi,
|
|
158 |
# Augmented enhanced score notes
|
159 |
|
160 |
src_escore = TMIDIX.recalculate_score_timings(TMIDIX.augment_enhanced_score_notes([e for e in raw_escore if e[6] < 80]))
|
|
|
|
|
161 |
|
162 |
src_cscore = TMIDIX.chordify_score([1000, src_escore])
|
163 |
|
@@ -280,6 +283,14 @@ def Mix_Melody(input_midi,
|
|
280 |
if input_remove_drums:
|
281 |
mixed_song = [e for e in mixed_song if e[3] != 9]
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
#===============================================================================
|
284 |
print('Rendering results...')
|
285 |
|
@@ -371,6 +382,7 @@ if __name__ == "__main__":
|
|
371 |
input_adjust_accompaniment_notes_durations = gr.Checkbox(label="Adjust accompaniment notes durations", value=False)
|
372 |
input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
|
373 |
input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
|
|
|
374 |
|
375 |
run_btn = gr.Button("mix melody", variant="primary")
|
376 |
|
@@ -387,19 +399,21 @@ if __name__ == "__main__":
|
|
387 |
input_find_best_match,
|
388 |
input_adjust_melody_notes_durations,
|
389 |
input_adjust_accompaniment_notes_durations,
|
|
|
390 |
input_output_as_solo_piano,
|
391 |
input_remove_drums
|
392 |
],
|
393 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
394 |
|
395 |
gr.Examples(
|
396 |
-
[["Abracadabra-Sample-Melody.mid", True, True, True, False, False],
|
397 |
-
["Sparks-Fly-Sample-Melody.mid", True, True, True, False, False],
|
398 |
],
|
399 |
[input_midi,
|
400 |
input_find_best_match,
|
401 |
input_adjust_melody_notes_durations,
|
402 |
input_adjust_accompaniment_notes_durations,
|
|
|
403 |
input_output_as_solo_piano,
|
404 |
input_remove_drums
|
405 |
],
|
|
|
122 |
input_find_best_match,
|
123 |
input_adjust_melody_notes_durations,
|
124 |
input_adjust_accompaniment_notes_durations,
|
125 |
+
input_match_source_MIDI_average_time,
|
126 |
input_output_as_solo_piano,
|
127 |
input_remove_drums
|
128 |
):
|
|
|
159 |
# Augmented enhanced score notes
|
160 |
|
161 |
src_escore = TMIDIX.recalculate_score_timings(TMIDIX.augment_enhanced_score_notes([e for e in raw_escore if e[6] < 80]))
|
162 |
+
|
163 |
+
src_avg_time = TMIDIX.escore_notes_averages(src_escore)[0]
|
164 |
|
165 |
src_cscore = TMIDIX.chordify_score([1000, src_escore])
|
166 |
|
|
|
283 |
if input_remove_drums:
|
284 |
mixed_song = [e for e in mixed_song if e[3] != 9]
|
285 |
|
286 |
+
if input_match_source_MIDI_average_time:
|
287 |
+
|
288 |
+
trg_avg_time = TMIDIX.escore_notes_averages(mixed_song)[0]
|
289 |
+
|
290 |
+
time_k = src_avg_time / trg_avg_time
|
291 |
+
|
292 |
+
mixed_song = TMIDIX.adjust_escore_notes_timings(mixed_song, time_k)
|
293 |
+
|
294 |
#===============================================================================
|
295 |
print('Rendering results...')
|
296 |
|
|
|
382 |
input_adjust_accompaniment_notes_durations = gr.Checkbox(label="Adjust accompaniment notes durations", value=False)
|
383 |
input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
|
384 |
input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
|
385 |
+
input_match_source_MIDI_average_time = gr.Checkbox(label="Match source MIDI average time", value=False)
|
386 |
|
387 |
run_btn = gr.Button("mix melody", variant="primary")
|
388 |
|
|
|
399 |
input_find_best_match,
|
400 |
input_adjust_melody_notes_durations,
|
401 |
input_adjust_accompaniment_notes_durations,
|
402 |
+
input_match_source_MIDI_average_time,
|
403 |
input_output_as_solo_piano,
|
404 |
input_remove_drums
|
405 |
],
|
406 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
407 |
|
408 |
gr.Examples(
|
409 |
+
[["Abracadabra-Sample-Melody.mid", True, True, True, False, False, False],
|
410 |
+
["Sparks-Fly-Sample-Melody.mid", True, True, True, False, False, False],
|
411 |
],
|
412 |
[input_midi,
|
413 |
input_find_best_match,
|
414 |
input_adjust_melody_notes_durations,
|
415 |
input_adjust_accompaniment_notes_durations,
|
416 |
+
input_match_source_MIDI_average_time,
|
417 |
input_output_as_solo_piano,
|
418 |
input_remove_drums
|
419 |
],
|