asigalov61 commited on
Commit
9386e92
1 Parent(s): fec90c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -3
app.py CHANGED
@@ -112,18 +112,42 @@ def MixMelody(input_midi):
112
  print('=' * 70)
113
  print('Done loading source and target MIDIs...!')
114
  print('=' * 70)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  #===============================================================================
117
  print('Rendering results...')
118
 
119
  print('=' * 70)
120
- print('Sample INTs', output[:12])
121
  print('=' * 70)
122
 
123
- output_score, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(output)
124
 
125
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(output_score,
126
- output_signature = 'MIDI Melody',
127
  output_file_name = fn1,
128
  track_name='Project Los Angeles',
129
  list_of_MIDI_patches=patches,
 
112
  print('=' * 70)
113
  print('Done loading source and target MIDIs...!')
114
  print('=' * 70)
115
+ print('Mixing...')
116
+
117
+ mixed_song = []
118
+
119
+ midx = 0
120
+
121
+ for c in cscore[:len(src_melody)]:
122
+ cho = copy.deepcopy(c)
123
+
124
+ patches = sorted(set([e[6] for e in c]))
125
+
126
+ if trg_patch in patches:
127
+
128
+ mixed_song.extend(mix_chord(c, src_harm_tones_chords[midx], trg_patch, src_melody_pitches[midx]))
129
+
130
+ midx += 1
131
+
132
+ else:
133
+ mixed_song.extend(mix_chord(cho, src_harm_tones_chords[midx], trg_patch, src_melody_pitches[midx]))
134
+
135
+
136
+ print('=' * 70)
137
+ print('Done!')
138
+ print('=' * 70)
139
 
140
  #===============================================================================
141
  print('Rendering results...')
142
 
143
  print('=' * 70)
144
+ print('Sample INTs', mixed_song[:5])
145
  print('=' * 70)
146
 
147
+ output_score, patches, overflow_patches = TMIDIX.patch_enhanced_score_notes(mixed_song)
148
 
149
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(output_score,
150
+ output_signature = 'Harmonic Melody MIDI Mixer',
151
  output_file_name = fn1,
152
  track_name='Project Los Angeles',
153
  list_of_MIDI_patches=patches,