asigalov61 commited on
Commit
8f7775a
·
verified ·
1 Parent(s): d0031d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -37,7 +37,7 @@ def pitches_counts(melody_score):
37
  count += 1
38
  else:
39
  count = 0
40
- pcounts.append(p)
41
  pp = p
42
 
43
  return pcounts
@@ -66,7 +66,7 @@ def find_similar_song(songs, src_melody):
66
 
67
  max_ratio = max(ratios)
68
 
69
- return songs[ratios.index(max_ratio)], max_ratio
70
 
71
  # =================================================================================================
72
 
@@ -167,9 +167,10 @@ def MixMelody(input_midi, input_find_best_match, input_adjust_melody_notes_durat
167
  random.shuffle(matched_songs)
168
 
169
  max_match_ratio = -1
 
170
 
171
  if input_find_best_match:
172
- new_song, max_match_ratio = find_similar_song(matched_songs, src_melody)
173
  else:
174
  new_song = random.choice(matched_songs)
175
 
@@ -177,13 +178,13 @@ def MixMelody(input_midi, input_find_best_match, input_adjust_melody_notes_durat
177
  print('Selected melody match ratio:', max_match_ratio)
178
  print('Selected melody instrument:', TMIDIX.Number2patch[new_song[1]], '(', new_song[1], ')')
179
  print('Melody notes count:', new_song[2])
180
- print('Matched melodies pool count', len(matched_songs))
181
 
182
  MIDI_Summary = 'Selected Monster Mono Melodies MIDI: ' + str(new_song[0]) + '\n'
183
  MIDI_Summary += 'Selected melody match ratio: ' + str(max_match_ratio) + '\n'
184
  MIDI_Summary += 'Selected melody instrument: ' + str(TMIDIX.Number2patch[new_song[1]]) + ' (' + str(new_song[1]) + ')' + '\n'
185
  MIDI_Summary += 'Melody notes count: ' + str(new_song[2]) + '\n'
186
- MIDI_Summary += 'Matched melodies pool count: ' + str(len(matched_songs))
187
 
188
  fn1 += '_' + str(new_song[0]) + '_' + str(TMIDIX.Number2patch[new_song[1]]) + '_' + str(new_song[1]) + '_' + str(new_song[2])
189
 
 
37
  count += 1
38
  else:
39
  count = 0
40
+ pcounts.append(count)
41
  pp = p
42
 
43
  return pcounts
 
66
 
67
  max_ratio = max(ratios)
68
 
69
+ return songs[ratios.index(max_ratio)], max_ratio, ratios.count(max_ratio)
70
 
71
  # =================================================================================================
72
 
 
167
  random.shuffle(matched_songs)
168
 
169
  max_match_ratio = -1
170
+ max_match_ratios_count = len(matched_songs)
171
 
172
  if input_find_best_match:
173
+ new_song, max_match_ratio, max_match_ratios_count = find_similar_song(matched_songs, src_melody)
174
  else:
175
  new_song = random.choice(matched_songs)
176
 
 
178
  print('Selected melody match ratio:', max_match_ratio)
179
  print('Selected melody instrument:', TMIDIX.Number2patch[new_song[1]], '(', new_song[1], ')')
180
  print('Melody notes count:', new_song[2])
181
+ print('Matched melodies pool count', max_match_ratios_count)
182
 
183
  MIDI_Summary = 'Selected Monster Mono Melodies MIDI: ' + str(new_song[0]) + '\n'
184
  MIDI_Summary += 'Selected melody match ratio: ' + str(max_match_ratio) + '\n'
185
  MIDI_Summary += 'Selected melody instrument: ' + str(TMIDIX.Number2patch[new_song[1]]) + ' (' + str(new_song[1]) + ')' + '\n'
186
  MIDI_Summary += 'Melody notes count: ' + str(new_song[2]) + '\n'
187
+ MIDI_Summary += 'Matched melodies pool count: ' + str(max_match_ratios_count)
188
 
189
  fn1 += '_' + str(new_song[0]) + '_' + str(TMIDIX.Number2patch[new_song[1]]) + '_' + str(new_song[1]) + '_' + str(new_song[2])
190