asigalov61 commited on
Commit
22a9023
·
verified ·
1 Parent(s): c8071ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -20
app.py CHANGED
@@ -157,48 +157,65 @@ def GenerateGroove():
157
  print('Rendering results...')
158
 
159
  print('=' * 70)
160
- print('Sample INTs', output[:12])
161
  print('=' * 70)
162
-
163
- out1 = output
164
 
165
- if len(out1) != 0:
166
 
167
- song = out1
168
  song_f = []
169
 
170
  time = 0
171
- dur = 0
172
  vel = 90
173
- pitch = 0
 
174
  channel = 0
175
 
176
- patches = [0] * 16
 
 
177
 
178
- channel = 0
179
 
180
- for ss in song:
181
 
182
- if 0 <= ss < 128:
183
 
184
- time += ss * 32
185
 
186
- if 128 <= ss < 256:
187
 
188
- dur = (ss-128) * 32
189
 
190
- if 256 <= ss < 384:
191
 
192
- pitch = (ss-256)
193
 
194
- vel = max(40, pitch)
 
 
 
 
 
 
195
 
196
- song_f.append(['note', time, dur, channel, pitch, vel, 0])
 
 
 
 
 
 
 
 
 
 
197
 
198
- fn1 = "Chords-Progressions-Transformer-Composition"
199
 
200
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
201
- output_signature = 'Chords Progressions Transformer',
202
  output_file_name = fn1,
203
  track_name='Project Los Angeles',
204
  list_of_MIDI_patches=patches
 
157
  print('Rendering results...')
158
 
159
  print('=' * 70)
160
+ print('Sample INTs', outy[:12])
161
  print('=' * 70)
 
 
162
 
163
+ if len(outy) != 0:
164
 
165
+ song = outy
166
  song_f = []
167
 
168
  time = 0
169
+ dur = 32
170
  vel = 90
171
+ dvels = [100, 120]
172
+ pitch = 60
173
  channel = 0
174
 
175
+ patches = [0, 10, 19, 24, 35, 40, 52, 56, 65, 9, 73, 0, 0, 0, 0, 0]
176
+
177
+ for ss in song:
178
 
179
+ if 0 <= ss < 128:
180
 
181
+ time += ss * 32
182
 
183
+ if 128 <= ss < 256:
184
 
185
+ song_f.append(['note', time, 32, 9, ss-128, dvels[(ss-128) % 2], 128])
186
 
187
+ if 256 < ss < 384:
188
 
189
+ dur = (ss-256) * 32
190
 
191
+ if 384 < ss < 1664:
192
 
193
+ chan = (ss-384) // 128
194
 
195
+ if chan == 11:
196
+ channel = 9
197
+ else:
198
+ if chan > 8:
199
+ channel = chan + 1
200
+ else:
201
+ channel = chan
202
 
203
+ if channel == 9:
204
+ patch = 128
205
+ else:
206
+ patch = channel * 8
207
+
208
+ pitch = (ss-384) % 128
209
+
210
+ vel = max(50, pitch)
211
+
212
+ song_f.append(['note', time, dur, channel, pitch, vel, patch])
213
+
214
 
215
+ fn1 = drums_score_fn
216
 
217
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
218
+ output_signature = 'Groove Music Transformer',
219
  output_file_name = fn1,
220
  track_name='Project Los Angeles',
221
  list_of_MIDI_patches=patches