asigalov61 commited on
Commit
9a96351
1 Parent(s): e1ba81d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -14
app.py CHANGED
@@ -178,13 +178,15 @@ def Render_MIDI(input_midi,
178
  if render_type == "Multi-Instrumental Summary":
179
  zscore = TMIDIX.recalculate_score_timings(output_score)
180
  c_escore_notes = TMIDIX.compress_patches_in_escore_notes_chords(zscore)
181
- cmatrix = TMIDIX.escore_notes_to_image_matrix(c_escore_notes, filter_out_zero_rows=True, filter_out_duplicate_rows=True)
182
- smatrix = TPLOTS.square_image_matrix(cmatrix)
183
- output_score = TMIDIX.image_matrix_to_original_escore_notes(smatrix)
184
 
185
- for o in output_score:
186
- o[1] *= 250
187
- o[2] *= 250
 
 
 
 
 
188
 
189
  if render_output_as_solo_piano:
190
  output_score = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=True)
@@ -195,14 +197,17 @@ def Render_MIDI(input_midi,
195
  if render_type == "Solo Piano Summary":
196
  sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=False)
197
  zscore = TMIDIX.recalculate_score_timings(sp_escore_notes)
198
- bmatrix = TMIDIX.escore_notes_to_binary_matrix(zscore)
199
- cmatrix = TMIDIX.compress_binary_matrix(bmatrix, only_compress_zeros=True)
200
- smatrix = TPLOTS.square_binary_matrix(cmatrix)
201
- output_score = TMIDIX.binary_matrix_to_original_escore_notes(smatrix)
202
-
203
- for o in output_score:
204
- o[1] *= 200
205
- o[2] *= 200
 
 
 
206
 
207
  SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
208
 
 
178
  if render_type == "Multi-Instrumental Summary":
179
  zscore = TMIDIX.recalculate_score_timings(output_score)
180
  c_escore_notes = TMIDIX.compress_patches_in_escore_notes_chords(zscore)
 
 
 
181
 
182
+ if len(c_escore_notes) > 128:
183
+ cmatrix = TMIDIX.escore_notes_to_image_matrix(c_escore_notes, filter_out_zero_rows=True, filter_out_duplicate_rows=True)
184
+ smatrix = TPLOTS.square_image_matrix(cmatrix)
185
+ output_score = TMIDIX.image_matrix_to_original_escore_notes(smatrix)
186
+
187
+ for o in output_score:
188
+ o[1] *= 250
189
+ o[2] *= 250
190
 
191
  if render_output_as_solo_piano:
192
  output_score = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=True)
 
197
  if render_type == "Solo Piano Summary":
198
  sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score, keep_drums=False)
199
  zscore = TMIDIX.recalculate_score_timings(sp_escore_notes)
200
+
201
+ if len(zscore) > 128:
202
+
203
+ bmatrix = TMIDIX.escore_notes_to_binary_matrix(zscore)
204
+ cmatrix = TMIDIX.compress_binary_matrix(bmatrix, only_compress_zeros=True)
205
+ smatrix = TPLOTS.square_binary_matrix(cmatrix)
206
+ output_score = TMIDIX.binary_matrix_to_original_escore_notes(smatrix)
207
+
208
+ for o in output_score:
209
+ o[1] *= 200
210
+ o[2] *= 200
211
 
212
  SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
213