asigalov61 commited on
Commit
e94f552
1 Parent(s): 395f8ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -4,6 +4,7 @@
4
 
5
  import os
6
  import hashlib
 
7
  import time
8
  import datetime
9
  from pytz import timezone
@@ -11,6 +12,8 @@ from pytz import timezone
11
  import gradio as gr
12
 
13
  import TMIDIX
 
 
14
  from midi_to_colab_audio import midi_to_colab_audio
15
 
16
  import copy
@@ -151,14 +154,16 @@ def render_midi(input_midi,
151
  output_score = TMIDIX.strip_drums_from_escore_notes(output_score)
152
 
153
  if render_type == "Summarize":
154
- sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score)
155
- bmatrix = TMIDIX.escore_notes_to_binary_matrix(sp_escore_notes)
156
- smatrix = TMIDIX.square_binary_matrix(bmatrix)
 
 
157
  output_score = TMIDIX.binary_matrix_to_original_escore_notes(smatrix)
158
 
159
  for o in output_score:
160
- o[1] *= 160
161
- o[2] *= 160
162
 
163
  SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
164
 
 
4
 
5
  import os
6
  import hashlib
7
+
8
  import time
9
  import datetime
10
  from pytz import timezone
 
12
  import gradio as gr
13
 
14
  import TMIDIX
15
+ import TPLOTS
16
+
17
  from midi_to_colab_audio import midi_to_colab_audio
18
 
19
  import copy
 
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)
160
+ cmatrix = TMIDIX.compress_binary_matrix(bmatrix, only_compress_zeros=True)
161
+ smatrix = TPLOTS.square_binary_matrix(cmatrix)
162
  output_score = TMIDIX.binary_matrix_to_original_escore_notes(smatrix)
163
 
164
  for o in output_score:
165
+ o[1] *= 200
166
+ o[2] *= 200
167
 
168
  SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
169