asigalov61 commited on
Commit
de3057c
1 Parent(s): d49220e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -126,7 +126,25 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
126
  output_score = []
127
 
128
  for c in cscore:
129
- output_score.extend(c)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  print('Done processing!')
132
  print('=' * 70)
 
126
  output_score = []
127
 
128
  for c in cscore:
129
+ tones_chord = sorted(set([t[4] % 12 for t in c if t[3] != 9]))
130
+ drums_events = [t for t in c if t[3] == 9]
131
+
132
+ if tones_chord:
133
+
134
+ new_tones_chord = TMIDIX.check_and_fix_tones_chord(tones_chord)
135
+
136
+ if len(c) > 1:
137
+ output_score.extend([c[0]])
138
+ for cc in c[1:]:
139
+ if cc[3] != 9:
140
+ if (cc[4] % 12) in new_tones_chord:
141
+ output_score.extend([cc])
142
+ output_score.extend(drums_events)
143
+ else:
144
+
145
+ output_score.extend([c[0]])
146
+ else:
147
+ output_score.extend(c)
148
 
149
  print('Done processing!')
150
  print('=' * 70)