Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,9 +80,18 @@ def render_midi(input_midi, render_options):
|
|
| 80 |
print('=' * 70)
|
| 81 |
print('Processing...Please wait...')
|
| 82 |
|
| 83 |
-
if
|
| 84 |
output_score = escore
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
print('Done processing!')
|
| 87 |
print('=' * 70)
|
| 88 |
|
|
@@ -115,6 +124,8 @@ def render_midi(input_midi, render_options):
|
|
| 115 |
patches[patches.index(-1)] = e[6]
|
| 116 |
else:
|
| 117 |
patches[-1] = e[6]
|
|
|
|
|
|
|
| 118 |
|
| 119 |
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(output_score,
|
| 120 |
output_signature = 'Advanced MIDI Renderer',
|
|
|
|
| 80 |
print('=' * 70)
|
| 81 |
print('Processing...Please wait...')
|
| 82 |
|
| 83 |
+
if not render_options:
|
| 84 |
output_score = escore
|
| 85 |
|
| 86 |
+
elif "Render as-is" in render_options:
|
| 87 |
+
output_score = escore
|
| 88 |
+
|
| 89 |
+
elif "Extract melody" in render_options:
|
| 90 |
+
output_score = [c[0] for c in cscore if c[0][3] != 9]
|
| 91 |
+
for e in output_score:
|
| 92 |
+
e[3] = 0
|
| 93 |
+
e[6] = 40
|
| 94 |
+
|
| 95 |
print('Done processing!')
|
| 96 |
print('=' * 70)
|
| 97 |
|
|
|
|
| 124 |
patches[patches.index(-1)] = e[6]
|
| 125 |
else:
|
| 126 |
patches[-1] = e[6]
|
| 127 |
+
|
| 128 |
+
patches = [p if p != -1 else 0 for p in patches]
|
| 129 |
|
| 130 |
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(output_score,
|
| 131 |
output_signature = 'Advanced MIDI Renderer',
|