asigalov61 commited on
Commit
cf187c8
1 Parent(s): 8405a97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -147,13 +147,24 @@ def render_midi(input_midi,
147
  output_score = TMIDIX.recalculate_score_timings(output_score)
148
  output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
149
 
 
 
 
 
 
 
 
 
 
 
 
150
  if render_output_as_solo_piano:
151
  output_score = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=True)
152
 
153
  if render_remove_drums:
154
  output_score = TMIDIX.strip_drums_from_escore_notes(output_score)
155
 
156
- if render_type == "Summarize":
157
  sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=False)
158
  zscore = TMIDIX.recalculate_score_timings(sp_escore_notes)
159
  bmatrix = TMIDIX.escore_notes_to_binary_matrix(zscore)
@@ -272,7 +283,8 @@ if __name__ == "__main__":
272
  "Flip",
273
  "Reverse",
274
  "Repair",
275
- "Summarize"
 
276
  ],
277
  label="Render type",
278
  value="Render as-is"
 
147
  output_score = TMIDIX.recalculate_score_timings(output_score)
148
  output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
149
 
150
+ if render_type == "Multi-Instrumental Summary":
151
+ zscore = TMIDIX.recalculate_score_timings(output_score)
152
+ c_escore_notes = TMIDIX.compress_patches_in_escore_notes_chords(zscore)
153
+ cmatrix = TMIDIX.escore_notes_to_image_matrix(c_escore_notes, filter_out_zero_rows=True, filter_out_duplicate_rows=True)
154
+ smatrix = TPLOTS.square_image_matrix(cmatrix)
155
+ output_score = TMIDIX.image_matrix_to_original_escore_notes(smatrix)
156
+
157
+ for o in output_score:
158
+ o[1] *= 250
159
+ o[2] *= 250
160
+
161
  if render_output_as_solo_piano:
162
  output_score = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=True)
163
 
164
  if render_remove_drums:
165
  output_score = TMIDIX.strip_drums_from_escore_notes(output_score)
166
 
167
+ if render_type == "Solo Piano Summary":
168
  sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=False)
169
  zscore = TMIDIX.recalculate_score_timings(sp_escore_notes)
170
  bmatrix = TMIDIX.escore_notes_to_binary_matrix(zscore)
 
283
  "Flip",
284
  "Reverse",
285
  "Repair",
286
+ "Solo Piano Summary",
287
+ "Multi-Instrumental Summary"
288
  ],
289
  label="Render type",
290
  value="Render as-is"