asigalov61 commited on
Commit
ac062f7
1 Parent(s): 4de2d58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -124,7 +124,8 @@ def Mix_Melody(input_midi,
124
  input_adjust_accompaniment_notes_durations,
125
  input_output_as_solo_piano,
126
  input_remove_drums,
127
- input_output_tempo
 
128
  ):
129
 
130
  print('=' * 70)
@@ -144,6 +145,7 @@ def Mix_Melody(input_midi,
144
  print('Output as Solo Piano:', input_output_as_solo_piano)
145
  print('Remove drums:', input_remove_drums)
146
  print('Output tempo:', input_output_tempo)
 
147
  print('-' * 70)
148
 
149
  #===============================================================================
@@ -299,6 +301,9 @@ def Mix_Melody(input_midi,
299
  time_k = mel_avg_time / mix_mel_avg_time
300
 
301
  mixed_song = TMIDIX.adjust_escore_notes_timings(mixed_song, time_k)
 
 
 
302
 
303
  #===============================================================================
304
  print('Rendering results...')
@@ -392,6 +397,7 @@ if __name__ == "__main__":
392
  input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
393
  input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
394
  input_output_tempo = gr.Radio(["Mix Melody", "Source Melody", "Mix"], value="Mix Melody", label="Output tempo")
 
395
 
396
  run_btn = gr.Button("mix melody", variant="primary")
397
 
@@ -410,13 +416,14 @@ if __name__ == "__main__":
410
  input_adjust_accompaniment_notes_durations,
411
  input_output_as_solo_piano,
412
  input_remove_drums,
413
- input_output_tempo
 
414
  ],
415
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
416
 
417
  gr.Examples(
418
- [["Abracadabra-Sample-Melody.mid", True, True, True, False, False, "Mix Melody"],
419
- ["Sparks-Fly-Sample-Melody.mid", True, True, True, False, False, "Mix Melody"],
420
  ],
421
  [input_midi,
422
  input_find_best_match,
@@ -424,7 +431,8 @@ if __name__ == "__main__":
424
  input_adjust_accompaniment_notes_durations,
425
  input_output_as_solo_piano,
426
  input_remove_drums,
427
- input_output_tempo
 
428
  ],
429
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
430
  Mix_Melody,
 
124
  input_adjust_accompaniment_notes_durations,
125
  input_output_as_solo_piano,
126
  input_remove_drums,
127
+ input_output_tempo,
128
+ input_transpose_value
129
  ):
130
 
131
  print('=' * 70)
 
145
  print('Output as Solo Piano:', input_output_as_solo_piano)
146
  print('Remove drums:', input_remove_drums)
147
  print('Output tempo:', input_output_tempo)
148
+ print('Transpose value:', input_transpose_value)
149
  print('-' * 70)
150
 
151
  #===============================================================================
 
301
  time_k = mel_avg_time / mix_mel_avg_time
302
 
303
  mixed_song = TMIDIX.adjust_escore_notes_timings(mixed_song, time_k)
304
+
305
+ if input_transpose_value != 0:
306
+ mixed_song = TMIDIX.transpose_escore_notes(mixed_song, input_transpose_value)
307
 
308
  #===============================================================================
309
  print('Rendering results...')
 
397
  input_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
398
  input_remove_drums = gr.Checkbox(label="Remove drums from output", value=False)
399
  input_output_tempo = gr.Radio(["Mix Melody", "Source Melody", "Mix"], value="Mix Melody", label="Output tempo")
400
+ input_transpose_value = gr.Slider(-12, 12, value=0, step=1, label="Transpose value")
401
 
402
  run_btn = gr.Button("mix melody", variant="primary")
403
 
 
416
  input_adjust_accompaniment_notes_durations,
417
  input_output_as_solo_piano,
418
  input_remove_drums,
419
+ input_output_tempo,
420
+ input_transpose_value
421
  ],
422
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
423
 
424
  gr.Examples(
425
+ [["Abracadabra-Sample-Melody.mid", True, True, True, False, False, "Mix Melody", 0],
426
+ ["Sparks-Fly-Sample-Melody.mid", True, True, True, False, False, "Mix Melody", 0],
427
  ],
428
  [input_midi,
429
  input_find_best_match,
 
431
  input_adjust_accompaniment_notes_durations,
432
  input_output_as_solo_piano,
433
  input_remove_drums,
434
+ input_output_tempo,
435
+ input_transpose_value
436
  ],
437
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
438
  Mix_Melody,