Spaces:
Running
Running
asigalov61
commited on
Commit
•
f742df5
1
Parent(s):
78280d0
Update app.py
Browse files
app.py
CHANGED
@@ -72,6 +72,8 @@ def Mix_Chords(input_output_as_solo_piano,
|
|
72 |
|
73 |
src_cidxs = all_chords_indexes[sidx]
|
74 |
|
|
|
|
|
75 |
#=============================================================================================================
|
76 |
|
77 |
sidx = random.randint(0, len(all_chords_chunks)-1)
|
@@ -98,6 +100,8 @@ def Mix_Chords(input_output_as_solo_piano,
|
|
98 |
trg_counts = [chunks_lens[sidx]] + chords_drums_counts[sidx]
|
99 |
|
100 |
trg_cidxs = all_chords_indexes[sidx]
|
|
|
|
|
101 |
|
102 |
#=============================================================================================================
|
103 |
|
@@ -171,13 +175,13 @@ def Mix_Chords(input_output_as_solo_piano,
|
|
171 |
|
172 |
if input_output_tempo == 'Source MIDI':
|
173 |
|
174 |
-
time_k =
|
175 |
|
176 |
mixed_score = TMIDIX.adjust_escore_notes_timings(mixed_score, time_k)
|
177 |
|
178 |
elif input_output_tempo == 'Target MIDI':
|
179 |
|
180 |
-
time_k =
|
181 |
|
182 |
mixed_score = TMIDIX.adjust_escore_notes_timings(mixed_score, time_k)
|
183 |
|
@@ -325,7 +329,7 @@ if __name__ == "__main__":
|
|
325 |
input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
|
326 |
input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
|
327 |
input_output_tempo = gr.Radio(["Source MIDI", "Target MIDI", "MIDI Mix"], value="Mix", label="Output tempo")
|
328 |
-
input_transform = gr.Radio(["As-is", "Flip
|
329 |
input_transpose_value = gr.Slider(-12, 12, value=0, step=1, label="Transpose value")
|
330 |
input_transpose_to_C4 = gr.Checkbox(label="Transpose to C4", value=False)
|
331 |
|
|
|
72 |
|
73 |
src_cidxs = all_chords_indexes[sidx]
|
74 |
|
75 |
+
src_avg_time = TMIDIX.escore_notes_averages(src_escore_notes)[0]
|
76 |
+
|
77 |
#=============================================================================================================
|
78 |
|
79 |
sidx = random.randint(0, len(all_chords_chunks)-1)
|
|
|
100 |
trg_counts = [chunks_lens[sidx]] + chords_drums_counts[sidx]
|
101 |
|
102 |
trg_cidxs = all_chords_indexes[sidx]
|
103 |
+
|
104 |
+
trg_avg_time = TMIDIX.escore_notes_averages(trg_escore_notes)[0]
|
105 |
|
106 |
#=============================================================================================================
|
107 |
|
|
|
175 |
|
176 |
if input_output_tempo == 'Source MIDI':
|
177 |
|
178 |
+
time_k = src_avg_time / trg_avg_time
|
179 |
|
180 |
mixed_score = TMIDIX.adjust_escore_notes_timings(mixed_score, time_k)
|
181 |
|
182 |
elif input_output_tempo == 'Target MIDI':
|
183 |
|
184 |
+
time_k = trg_avg_time / src_avg_time
|
185 |
|
186 |
mixed_score = TMIDIX.adjust_escore_notes_timings(mixed_score, time_k)
|
187 |
|
|
|
329 |
input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
|
330 |
input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
|
331 |
input_output_tempo = gr.Radio(["Source MIDI", "Target MIDI", "MIDI Mix"], value="Mix", label="Output tempo")
|
332 |
+
input_transform = gr.Radio(["As-is", "Flip Mix", "Reverse Mix"], value="As-is", label="Transform")
|
333 |
input_transpose_value = gr.Slider(-12, 12, value=0, step=1, label="Transpose value")
|
334 |
input_transpose_to_C4 = gr.Checkbox(label="Transpose to C4", value=False)
|
335 |
|