asigalov61 commited on
Commit
1d137aa
1 Parent(s): 8a1f411

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -19
app.py CHANGED
@@ -131,26 +131,11 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
131
  output_score = []
132
 
133
  for c in cscore:
134
- tones_chord = sorted(set([t[4] % 12 for t in c if t[3] != 9]))
135
- notes_events = [t for t in c if t[3] != 9]
136
- drums_events = [t for t in c if t[3] == 9]
137
 
138
- if tones_chord:
139
-
140
- new_tones_chord = TMIDIX.check_and_fix_tones_chord(tones_chord)
141
-
142
- if len(notes_events) > 1:
143
- output_score.extend([notes_events[0]])
144
- for cc in notes_events[1:]:
145
- if cc[3] != 9:
146
- if (cc[4] % 12) in new_tones_chord:
147
- output_score.extend([cc])
148
- output_score.extend(drums_events)
149
- else:
150
-
151
- output_score.extend([notes_events[0]])
152
- else:
153
- output_score.extend(c)
154
 
155
  output_score.sort(key= lambda x: x[1])
156
 
@@ -167,6 +152,9 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
167
  if -1 < custom_render_patch < 128:
168
  if e[3] != 9:
169
  e[6] = custom_render_patch
 
 
 
170
 
171
  print('Done recalculating timings!')
172
  print('=' * 70)
 
131
  output_score = []
132
 
133
  for c in cscore:
134
+ c.sort(key=lambda x: x[4], reverse=True)
 
 
135
 
136
+ fixed_chord = TMIDIX.check_and_fix_chord(c)
137
+
138
+ output_score.extend(fixed_chord)
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
  output_score.sort(key= lambda x: x[1])
141
 
 
152
  if -1 < custom_render_patch < 128:
153
  if e[3] != 9:
154
  e[6] = custom_render_patch
155
+ else:
156
+ if e[3] != 9:
157
+ e[6] = 0
158
 
159
  print('Done recalculating timings!')
160
  print('=' * 70)