asigalov61 commited on
Commit
b9703ed
1 Parent(s): f626247

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -96,6 +96,24 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, mel
96
  if e[4] < 60:
97
  e[4] = (e[4] % 12) + 60
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  elif render_type == "Transform":
100
  output_score = copy.deepcopy(escore)
101
 
 
96
  if e[4] < 60:
97
  e[4] = (e[4] % 12) + 60
98
 
99
+ fixed_score = []
100
+
101
+ for i in range(len(output_score)-1):
102
+ note = output_score[i]
103
+
104
+ nmt = output_score[i+1][1]
105
+
106
+ if note[1]+note[2] >= nmt:
107
+ note_dur = nmt-note[1]-1
108
+ else:
109
+ note_dur = note[2]
110
+
111
+ fixed_score.append([note[0], note[1], note_dur, note[3], note[4], note[5], note[6]])
112
+
113
+ fixed_score.append(output_score[-1])
114
+
115
+ output_score = copy.deepcopy(fixed_score)
116
+
117
  elif render_type == "Transform":
118
  output_score = copy.deepcopy(escore)
119