asigalov61
commited on
Commit
•
ebd096a
1
Parent(s):
3ec538e
Update app.py
Browse files
app.py
CHANGED
@@ -66,10 +66,7 @@ def find_similar_song(songs, src_melody):
|
|
66 |
|
67 |
max_ratio = max(ratios)
|
68 |
|
69 |
-
|
70 |
-
print(ratios.count(1.0))
|
71 |
-
|
72 |
-
return songs[ratios.index(max_ratio)]
|
73 |
|
74 |
# =================================================================================================
|
75 |
|
@@ -167,17 +164,21 @@ def MixMelody(input_midi, input_find_best_match):
|
|
167 |
|
168 |
random.shuffle(matched_songs)
|
169 |
|
|
|
|
|
170 |
if input_find_best_match:
|
171 |
-
new_song = find_similar_song(matched_songs, src_melody)
|
172 |
else:
|
173 |
new_song = random.choice(matched_songs)
|
174 |
|
175 |
print('Selected Monster Mono Melodies MIDI:', new_song[0])
|
|
|
176 |
print('Selected melody instrument:', TMIDIX.Number2patch[new_song[1]], '(', new_song[1], ')')
|
177 |
print('Melody notes count:', new_song[2])
|
178 |
print('Matched melodies pool count', len(matched_songs))
|
179 |
|
180 |
MIDI_Summary = 'Selected Monster Mono Melodies MIDI: ' + str(new_song[0]) + '\n'
|
|
|
181 |
MIDI_Summary += 'Selected melody instrument: ' + str(TMIDIX.Number2patch[new_song[1]]) + ' (' + str(new_song[1]) + ')' + '\n'
|
182 |
MIDI_Summary += 'Melody notes count: ' + str(new_song[2]) + '\n'
|
183 |
MIDI_Summary += 'Matched melodies pool count: ' + str(len(matched_songs))
|
@@ -277,7 +278,7 @@ def MixMelody(input_midi, input_find_best_match):
|
|
277 |
|
278 |
print('Output MIDI file name:', output_midi)
|
279 |
print('Output MIDI title:', output_midi_title)
|
280 |
-
print('Output MIDI summary:',
|
281 |
print('=' * 70)
|
282 |
|
283 |
|
|
|
66 |
|
67 |
max_ratio = max(ratios)
|
68 |
|
69 |
+
return songs[ratios.index(max_ratio)], max_ratio
|
|
|
|
|
|
|
70 |
|
71 |
# =================================================================================================
|
72 |
|
|
|
164 |
|
165 |
random.shuffle(matched_songs)
|
166 |
|
167 |
+
max_match_ratio = -1
|
168 |
+
|
169 |
if input_find_best_match:
|
170 |
+
new_song, max_match_ratio = find_similar_song(matched_songs, src_melody)
|
171 |
else:
|
172 |
new_song = random.choice(matched_songs)
|
173 |
|
174 |
print('Selected Monster Mono Melodies MIDI:', new_song[0])
|
175 |
+
print('Selected melody match ratio:', max_match_ratio)
|
176 |
print('Selected melody instrument:', TMIDIX.Number2patch[new_song[1]], '(', new_song[1], ')')
|
177 |
print('Melody notes count:', new_song[2])
|
178 |
print('Matched melodies pool count', len(matched_songs))
|
179 |
|
180 |
MIDI_Summary = 'Selected Monster Mono Melodies MIDI: ' + str(new_song[0]) + '\n'
|
181 |
+
MIDI_Summary += 'Selected melody match ratio:' + str(max_match_ratio) + '\n'
|
182 |
MIDI_Summary += 'Selected melody instrument: ' + str(TMIDIX.Number2patch[new_song[1]]) + ' (' + str(new_song[1]) + ')' + '\n'
|
183 |
MIDI_Summary += 'Melody notes count: ' + str(new_song[2]) + '\n'
|
184 |
MIDI_Summary += 'Matched melodies pool count: ' + str(len(matched_songs))
|
|
|
278 |
|
279 |
print('Output MIDI file name:', output_midi)
|
280 |
print('Output MIDI title:', output_midi_title)
|
281 |
+
print('Output MIDI summary:', MIDI_Summary)
|
282 |
print('=' * 70)
|
283 |
|
284 |
|