asigalov61 commited on
Commit
406db87
1 Parent(s): afa080c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -171,12 +171,17 @@ def render_midi(input_midi,
171
  output_score = TMIDIX.recalculate_score_timings(output_score)
172
  output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
173
 
174
- if render_type == "Summarize" and render_summary_type == 'Principal Phrase':
175
  zscore = TMIDIX.recalculate_score_timings(output_score)
176
  lrno_score = TMIDIX.escore_notes_lrno_pattern(zscore)
177
- output_score = TMIDIX.recalculate_score_timings(lrno_score)
178
 
179
- if render_type == "Summarize" and render_summary_type == 'Multi-Instrumental':
 
 
 
 
 
 
180
  zscore = TMIDIX.recalculate_score_timings(output_score)
181
  c_escore_notes = TMIDIX.compress_patches_in_escore_notes_chords(zscore)
182
  cmatrix = TMIDIX.escore_notes_to_image_matrix(c_escore_notes, filter_out_zero_rows=True, filter_out_duplicate_rows=True)
@@ -193,7 +198,7 @@ def render_midi(input_midi,
193
  if render_remove_drums:
194
  output_score = TMIDIX.strip_drums_from_escore_notes(output_score)
195
 
196
- if render_type == "Summarize" and render_summary_type == 'Solo Piano':
197
  sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=False)
198
  zscore = TMIDIX.recalculate_score_timings(sp_escore_notes)
199
  bmatrix = TMIDIX.escore_notes_to_binary_matrix(zscore)
@@ -367,7 +372,7 @@ if __name__ == "__main__":
367
 
368
  render_summary_type = gr.Radio(["Multi-Instrumental",
369
  "Solo Piano",
370
- "Principal Phrase",
371
  ],
372
  label="Summary type",
373
  value="Multi-Instrumental"
 
171
  output_score = TMIDIX.recalculate_score_timings(output_score)
172
  output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
173
 
174
+ if render_type == "Summarize" and render_summary_type == "Longest Repeating Phrase":
175
  zscore = TMIDIX.recalculate_score_timings(output_score)
176
  lrno_score = TMIDIX.escore_notes_lrno_pattern(zscore)
 
177
 
178
+ if lrno_score is not None:
179
+ output_score = TMIDIX.recalculate_score_timings(lrno_score)
180
+
181
+ else:
182
+ output_score = TMIDIX.escore_notes_middle(output_score, 50)
183
+
184
+ if render_type == "Summarize" and render_summary_type == "Multi-Instrumental":
185
  zscore = TMIDIX.recalculate_score_timings(output_score)
186
  c_escore_notes = TMIDIX.compress_patches_in_escore_notes_chords(zscore)
187
  cmatrix = TMIDIX.escore_notes_to_image_matrix(c_escore_notes, filter_out_zero_rows=True, filter_out_duplicate_rows=True)
 
198
  if render_remove_drums:
199
  output_score = TMIDIX.strip_drums_from_escore_notes(output_score)
200
 
201
+ if render_type == "Summarize" and render_summary_type == "Solo Piano":
202
  sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=False)
203
  zscore = TMIDIX.recalculate_score_timings(sp_escore_notes)
204
  bmatrix = TMIDIX.escore_notes_to_binary_matrix(zscore)
 
372
 
373
  render_summary_type = gr.Radio(["Multi-Instrumental",
374
  "Solo Piano",
375
+ "Longest Repeating Phrase",
376
  ],
377
  label="Summary type",
378
  value="Multi-Instrumental"