asigalov61 commited on
Commit
4490a32
1 Parent(s): 88546b0

Update app.py

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