asigalov61 commited on
Commit
19ff4f4
1 Parent(s): e5d44e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -204,17 +204,21 @@ def MixMelody(input_midi, input_find_best_match):
204
 
205
  if trg_patch in patches:
206
 
207
- if midx < len(src_melody):
208
  next_note_dtime = src_melody[midx+1][1] - src_melody[midx][1]
209
-
 
 
210
  mixed_song.extend(mix_chord(c, src_harm_tones_chords[midx], trg_patch, src_melody_pitches[midx], next_note_dtime))
211
 
212
  midx += 1
213
 
214
  else:
215
 
216
- if i < len(cscore):
217
  next_note_dtime = cscore[i+1][0][1] - cscore[i][0][1]
 
 
218
 
219
  mixed_song.extend(mix_chord(cho, src_harm_tones_chords[midx], trg_patch, src_melody_pitches[midx], next_note_dtime))
220
 
 
204
 
205
  if trg_patch in patches:
206
 
207
+ if midx < len(src_melody)-1:
208
  next_note_dtime = src_melody[midx+1][1] - src_melody[midx][1]
209
+ else:
210
+ next_note_dtime = 255
211
+
212
  mixed_song.extend(mix_chord(c, src_harm_tones_chords[midx], trg_patch, src_melody_pitches[midx], next_note_dtime))
213
 
214
  midx += 1
215
 
216
  else:
217
 
218
+ if i < len(cscore)-1:
219
  next_note_dtime = cscore[i+1][0][1] - cscore[i][0][1]
220
+ else:
221
+ next_note_dtime = 255
222
 
223
  mixed_song.extend(mix_chord(cho, src_harm_tones_chords[midx], trg_patch, src_melody_pitches[midx], next_note_dtime))
224