asigalov61 commited on
Commit
7594447
1 Parent(s): 22fe69b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -25,6 +25,7 @@ from midi_to_colab_audio import midi_to_colab_audio
25
  def Generate_Chords_Progression(total_song_length_in_chords_chunks,
26
  chords_chunks_memory_length,
27
  chord_time_step,
 
28
  melody_MIDI_patch_number,
29
  chords_progression_MIDI_patch_number,
30
  base_MIDI_patch_number
@@ -39,6 +40,7 @@ def Generate_Chords_Progression(total_song_length_in_chords_chunks,
39
  print('Total song length in chords chunks:', total_song_length_in_chords_chunks)
40
  print('Chords chunks memory length:', chords_chunks_memory_length)
41
  print('Chord time step:', chord_time_step)
 
42
  print('Melody MIDI patch number:', melody_MIDI_patch_number)
43
  print('Chords progression MIDI patch number:', chords_progression_MIDI_patch_number)
44
  print('Base MIDI patch number:', base_MIDI_patch_number)
@@ -174,7 +176,11 @@ def Generate_Chords_Progression(total_song_length_in_chords_chunks,
174
 
175
  if melody_MIDI_patch_number > -1:
176
  output_score = TMIDIX.add_melody_to_enhanced_score_notes(output_score, melody_patch=melody_MIDI_patch_number)
177
-
 
 
 
 
178
  midi_score = sorted(chords_labels + output_score, key=lambda x: x[1])
179
 
180
  fn1 = "Pitches-Chords-Progression-Composition"
@@ -333,6 +339,7 @@ if __name__ == "__main__":
333
  total_song_length_in_chords_chunks = gr.Slider(4, 10, value=8, step=1, label="Total song length in chords chunks")
334
  chords_chunks_memory_length = gr.Slider(-1, 12, value=-1, step=1, label="Chords chunks memory length")
335
  chord_time_step = gr.Slider(100, 1000, value=500, step=50, label="Chord time step")
 
336
  melody_MIDI_patch_number = gr.Slider(0, 127, value=40, step=1, label="Melody MIDI patch number")
337
  chords_progression_MIDI_patch_number = gr.Slider(0, 127, value=0, step=1, label="Chords progression MIDI patch number")
338
  base_MIDI_patch_number = gr.Slider(0, 127, value=35, step=1, label="Base MIDI patch number")
@@ -351,6 +358,7 @@ if __name__ == "__main__":
351
  [total_song_length_in_chords_chunks,
352
  chords_chunks_memory_length,
353
  chord_time_step,
 
354
  melody_MIDI_patch_number,
355
  chords_progression_MIDI_patch_number,
356
  base_MIDI_patch_number],
 
25
  def Generate_Chords_Progression(total_song_length_in_chords_chunks,
26
  chords_chunks_memory_length,
27
  chord_time_step,
28
+ merge_chords_notes,
29
  melody_MIDI_patch_number,
30
  chords_progression_MIDI_patch_number,
31
  base_MIDI_patch_number
 
40
  print('Total song length in chords chunks:', total_song_length_in_chords_chunks)
41
  print('Chords chunks memory length:', chords_chunks_memory_length)
42
  print('Chord time step:', chord_time_step)
43
+ print('Merge chords notes:', merge_chords_notes)
44
  print('Melody MIDI patch number:', melody_MIDI_patch_number)
45
  print('Chords progression MIDI patch number:', chords_progression_MIDI_patch_number)
46
  print('Base MIDI patch number:', base_MIDI_patch_number)
 
176
 
177
  if melody_MIDI_patch_number > -1:
178
  output_score = TMIDIX.add_melody_to_enhanced_score_notes(output_score, melody_patch=melody_MIDI_patch_number)
179
+
180
+ if merge_chords_notes:
181
+ escore_matrix = TMIDIX.escore_notes_to_escore_matrix(output_score)
182
+ output_score = TMIDIX.escore_matrix_to_merged_escore_notes(escore_matrix)
183
+
184
  midi_score = sorted(chords_labels + output_score, key=lambda x: x[1])
185
 
186
  fn1 = "Pitches-Chords-Progression-Composition"
 
339
  total_song_length_in_chords_chunks = gr.Slider(4, 10, value=8, step=1, label="Total song length in chords chunks")
340
  chords_chunks_memory_length = gr.Slider(-1, 12, value=-1, step=1, label="Chords chunks memory length")
341
  chord_time_step = gr.Slider(100, 1000, value=500, step=50, label="Chord time step")
342
+ merge_chords_notes = gr.Checkbox(label="Merge chords notes", value=True)
343
  melody_MIDI_patch_number = gr.Slider(0, 127, value=40, step=1, label="Melody MIDI patch number")
344
  chords_progression_MIDI_patch_number = gr.Slider(0, 127, value=0, step=1, label="Chords progression MIDI patch number")
345
  base_MIDI_patch_number = gr.Slider(0, 127, value=35, step=1, label="Base MIDI patch number")
 
358
  [total_song_length_in_chords_chunks,
359
  chords_chunks_memory_length,
360
  chord_time_step,
361
+ merge_chords_notes,
362
  melody_MIDI_patch_number,
363
  chords_progression_MIDI_patch_number,
364
  base_MIDI_patch_number],