Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,7 +71,7 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
|
|
| 71 |
|
| 72 |
print('Done!')
|
| 73 |
print('=' * 70)
|
| 74 |
-
print('Input MIDI metadata:', meta_data)
|
| 75 |
print('=' * 70)
|
| 76 |
print('Processing...Please wait...')
|
| 77 |
|
|
@@ -102,18 +102,15 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
|
|
| 102 |
print('Done processing!')
|
| 103 |
print('=' * 70)
|
| 104 |
|
| 105 |
-
print('
|
| 106 |
print('=' * 70)
|
| 107 |
-
|
| 108 |
-
for e in output_score:
|
| 109 |
-
e[1] = e[1] * 16
|
| 110 |
-
e[2] = e[2] * 16
|
| 111 |
|
| 112 |
-
|
|
|
|
| 113 |
if e[3] != 9:
|
| 114 |
e[6] = custom_render_patch
|
| 115 |
|
| 116 |
-
print('Done
|
| 117 |
print('=' * 70)
|
| 118 |
|
| 119 |
print('Sample output events', output_score[:5])
|
|
@@ -124,27 +121,14 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
|
|
| 124 |
|
| 125 |
if render_type != "Render as-is":
|
| 126 |
|
| 127 |
-
patches =
|
| 128 |
-
patches[9] = 9
|
| 129 |
-
|
| 130 |
-
for e in output_score:
|
| 131 |
-
if e[3] != 9:
|
| 132 |
-
if patches[e[3]] == -1:
|
| 133 |
-
patches[e[3]] = e[6]
|
| 134 |
-
else:
|
| 135 |
-
if patches[e[3]] != e[6]:
|
| 136 |
-
if -1 in patches:
|
| 137 |
-
patches[patches.index(-1)] = e[6]
|
| 138 |
-
else:
|
| 139 |
-
patches[-1] = e[6]
|
| 140 |
-
|
| 141 |
-
patches = [p if p != -1 else 0 for p in patches]
|
| 142 |
|
| 143 |
-
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(
|
| 144 |
output_signature = 'Advanced MIDI Renderer',
|
| 145 |
output_file_name = fn1,
|
| 146 |
track_name='Project Los Angeles',
|
| 147 |
-
list_of_MIDI_patches=patches
|
|
|
|
| 148 |
)
|
| 149 |
|
| 150 |
else:
|
|
@@ -189,7 +173,7 @@ def render_midi(input_midi, render_type, soundfont_bank, render_sample_rate, cus
|
|
| 189 |
print('Output MIDI file name:', output_midi)
|
| 190 |
print('Output MIDI title:', output_midi_title)
|
| 191 |
print('Output MIDI hash:', output_midi_md5)
|
| 192 |
-
print('Output MIDI summary:', output_midi_summary)
|
| 193 |
print('=' * 70)
|
| 194 |
|
| 195 |
|
|
|
|
| 71 |
|
| 72 |
print('Done!')
|
| 73 |
print('=' * 70)
|
| 74 |
+
print('Input MIDI metadata:', meta_data[:5])
|
| 75 |
print('=' * 70)
|
| 76 |
print('Processing...Please wait...')
|
| 77 |
|
|
|
|
| 102 |
print('Done processing!')
|
| 103 |
print('=' * 70)
|
| 104 |
|
| 105 |
+
print('Repatching if needed...')
|
| 106 |
print('=' * 70)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
+
if -1 < custom_render_patch < 128:
|
| 109 |
+
for e in output_score:
|
| 110 |
if e[3] != 9:
|
| 111 |
e[6] = custom_render_patch
|
| 112 |
|
| 113 |
+
print('Done repatching!')
|
| 114 |
print('=' * 70)
|
| 115 |
|
| 116 |
print('Sample output events', output_score[:5])
|
|
|
|
| 121 |
|
| 122 |
if render_type != "Render as-is":
|
| 123 |
|
| 124 |
+
SONG, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output_score)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
+
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(SONG,
|
| 127 |
output_signature = 'Advanced MIDI Renderer',
|
| 128 |
output_file_name = fn1,
|
| 129 |
track_name='Project Los Angeles',
|
| 130 |
+
list_of_MIDI_patches=patches,
|
| 131 |
+
timings_multiplier=16
|
| 132 |
)
|
| 133 |
|
| 134 |
else:
|
|
|
|
| 173 |
print('Output MIDI file name:', output_midi)
|
| 174 |
print('Output MIDI title:', output_midi_title)
|
| 175 |
print('Output MIDI hash:', output_midi_md5)
|
| 176 |
+
print('Output MIDI summary:', output_midi_summary[:5])
|
| 177 |
print('=' * 70)
|
| 178 |
|
| 179 |
|