Spaces:
Sleeping
Sleeping
asigalov61
commited on
Commit
•
91d5e8a
1
Parent(s):
b109aa2
Update app.py
Browse files
app.py
CHANGED
@@ -138,10 +138,41 @@ def find_midi(title, artist):
|
|
138 |
plt.scatter(x,y, c=c)
|
139 |
plt.xlabel("Time in MIDI ticks")
|
140 |
plt.ylabel("MIDI Pitch")
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
with open(f"MIDI-Search-Sample.mid", 'wb') as f:
|
143 |
-
f.write(MIDI.score2midi(
|
144 |
-
audio = synthesis(MIDI.score2opus(
|
145 |
yield AUX_DATA[search_index][0], "MIDI-Search-Sample.mid", (44100, audio), plt
|
146 |
|
147 |
#==========================================================================================================
|
|
|
138 |
plt.scatter(x,y, c=c)
|
139 |
plt.xlabel("Time in MIDI ticks")
|
140 |
plt.ylabel("MIDI Pitch")
|
141 |
+
|
142 |
+
output_signature = AUX_DATA[search_index][0]
|
143 |
+
track_name = 'Project Los Angeles'
|
144 |
+
text_encoding = 'ISO-8859-1'
|
145 |
+
|
146 |
+
list_of_MIDI_patches=[0, 24, 32, 40, 42, 46, 56, 71, 73, 0, 53, 19, 0, 0, 0, 0]
|
147 |
+
|
148 |
+
output_header = [1000,
|
149 |
+
[['set_tempo', 0, 1000000],
|
150 |
+
['time_signature', 0, 4, 2, 24, 8],
|
151 |
+
['track_name', 0, bytes(output_signature, text_encoding)]]]
|
152 |
+
|
153 |
+
patch_list = [['patch_change', 0, 0, list_of_MIDI_patches[0]],
|
154 |
+
['patch_change', 0, 1, list_of_MIDI_patches[1]],
|
155 |
+
['patch_change', 0, 2, list_of_MIDI_patches[2]],
|
156 |
+
['patch_change', 0, 3, list_of_MIDI_patches[3]],
|
157 |
+
['patch_change', 0, 4, list_of_MIDI_patches[4]],
|
158 |
+
['patch_change', 0, 5, list_of_MIDI_patches[5]],
|
159 |
+
['patch_change', 0, 6, list_of_MIDI_patches[6]],
|
160 |
+
['patch_change', 0, 7, list_of_MIDI_patches[7]],
|
161 |
+
['patch_change', 0, 8, list_of_MIDI_patches[8]],
|
162 |
+
['patch_change', 0, 9, list_of_MIDI_patches[9]],
|
163 |
+
['patch_change', 0, 10, list_of_MIDI_patches[10]],
|
164 |
+
['patch_change', 0, 11, list_of_MIDI_patches[11]],
|
165 |
+
['patch_change', 0, 12, list_of_MIDI_patches[12]],
|
166 |
+
['patch_change', 0, 13, list_of_MIDI_patches[13]],
|
167 |
+
['patch_change', 0, 14, list_of_MIDI_patches[14]],
|
168 |
+
['patch_change', 0, 15, list_of_MIDI_patches[15]],
|
169 |
+
['track_name', 0, bytes(track_name, text_encoding)]]
|
170 |
+
|
171 |
+
output = output_header + [patch_list + song_f]
|
172 |
+
|
173 |
with open(f"MIDI-Search-Sample.mid", 'wb') as f:
|
174 |
+
f.write(MIDI.score2midi(output)
|
175 |
+
audio = synthesis(MIDI.score2opus(output), soundfont_path)
|
176 |
yield AUX_DATA[search_index][0], "MIDI-Search-Sample.mid", (44100, audio), plt
|
177 |
|
178 |
#==========================================================================================================
|