-
Notifications
You must be signed in to change notification settings - Fork 1
/
ultimate_drums_transformer.py
867 lines (564 loc) · 22.8 KB
/
ultimate_drums_transformer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
# -*- coding: utf-8 -*-
"""Ultimate_Drums_Transformer.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/github/asigalov61/Ultimate-Drums-Transformer/blob/main/Ultimate_Drums_Transformer.ipynb
# Ultimate Drums Transformer (ver. 4.0)
***
Powered by tegridy-tools: https://github.com/asigalov61/tegridy-tools
***
WARNING: This complete implementation is a functioning model of the Artificial Intelligence. Please excercise great humility, care, and respect. https://www.nscai.gov/
***
#### Project Los Angeles
#### Tegridy Code 2024
***
# (GPU CHECK)
"""
#@title NVIDIA GPU check
!nvidia-smi
"""# (SETUP ENVIRONMENT)"""
#@title Install dependencies
!git clone --depth 1 https://github.com/asigalov61/Ultimate-Drums-Transformer
!pip install huggingface_hub
!pip install einops
!pip install torch-summary
!apt install fluidsynth #Pip does not work for some reason. Only apt works
# Commented out IPython magic to ensure Python compatibility.
#@title Import modules
print('=' * 70)
print('Loading core Ultimate Drums Transformer modules...')
import os
import copy
import pickle
import secrets
import statistics
from time import time
import tqdm
print('=' * 70)
print('Loading main Ultimate Drums Transformer modules...')
import torch
# %cd /content/Ultimate-Drums-Transformer
import TMIDIX
from midi_to_colab_audio import midi_to_colab_audio
from x_transformer_1_23_2 import *
import random
# %cd /content/
print('=' * 70)
print('Loading aux Ultimate Drums Transformer modules...')
import matplotlib.pyplot as plt
from torchsummary import summary
from sklearn import metrics
from IPython.display import Audio, display
from huggingface_hub import hf_hub_download
from google.colab import files
print('=' * 70)
print('Done!')
print('Enjoy! :)')
print('=' * 70)
"""# (LOAD MODEL)"""
#@title Load Ultimate Drums Transformer Pre-Trained Model
#@markdown Models selection
select_model = "59M-4L-Small-Very-Fast" # @param ["59M-4L-Small-Very-Fast", "109M-8L-Small-Fast"]
#@markdown Model precision option
model_precision = "bfloat16" # @param ["bfloat16", "float16"]
#@markdown bfloat16 == Half precision/faster speed (if supported, otherwise the model will default to float16)
#@markdown float16 == Full precision/fast speed
plot_tokens_embeddings = False # @param {type:"boolean"}
print('=' * 70)
print('Loading Ultimate Drums Transformer Pre-Trained Model...')
print('Please wait...')
print('=' * 70)
full_path_to_models_dir = "/content/Ultimate-Drums-Transformer/Models"
if select_model == '59M-4L-Small-Very-Fast':
depth = 4
model_checkpoint_file_name = 'Ultimate_Drums_Transformer_Small_Trained_Model_VER4_RST_VEL_4L_9107_steps_0.5467_loss_0.8231_acc.pth'
model_path = full_path_to_models_dir+'/Small_V4_RST_VEL/'+model_checkpoint_file_name
if os.path.isfile(model_path):
print('Model already exists...')
else:
hf_hub_download(repo_id='asigalov61/Ultimate-Drums-Transformer',
filename=model_checkpoint_file_name,
local_dir='/content/Ultimate-Drums-Transformer/Models/Small_V4_RST_VEL',
local_dir_use_symlinks=False)
else:
depth = 8
model_checkpoint_file_name = 'Ultimate_Drums_Transformer_Small_Trained_Model_VER4_RST_VEL_8L_12501_steps_0.4947_loss_0.8382_acc.pth'
model_path = full_path_to_models_dir+'/Small_V4_RST_VEL/'+model_checkpoint_file_name
if os.path.isfile(model_path):
print('Model already exists...')
else:
hf_hub_download(repo_id='asigalov61/Ultimate-Drums-Transformer',
filename=model_checkpoint_file_name,
local_dir='/content/Ultimate-Drums-Transformer/Models/Small_V4_RST_VEL',
local_dir_use_symlinks=False)
print('=' * 70)
print('Instantiating model...')
device_type = 'cuda'
if model_precision == 'bfloat16' and torch.cuda.is_bf16_supported():
dtype = 'bfloat16'
else:
dtype = 'float16'
if model_precision == 'float16':
dtype = 'float16'
ptdtype = {'bfloat16': torch.bfloat16, 'float16': torch.float16}[dtype]
ctx = torch.amp.autocast(device_type=device_type, dtype=ptdtype)
SEQ_LEN = 8192 # Models seq len
PAD_IDX = 393 # Models pad index
# instantiate the model
model = TransformerWrapper(
num_tokens = PAD_IDX+1,
max_seq_len = SEQ_LEN,
attn_layers = Decoder(dim = 1024, depth = depth, heads = 16, attn_flash = True)
)
model = AutoregressiveWrapper(model, ignore_index = PAD_IDX, pad_value=PAD_IDX)
model.cuda()
print('=' * 70)
print('Loading model checkpoint...')
model.load_state_dict(torch.load(model_path))
print('=' * 70)
model.eval()
print('Done!')
print('=' * 70)
print('Model will use', dtype, 'precision...')
print('=' * 70)
# Model stats
print('Model summary...')
summary(model)
# Plot Token Embeddings
if plot_tokens_embeddings:
tok_emb = model.net.token_emb.emb.weight.detach().cpu().tolist()
cos_sim = metrics.pairwise_distances(
tok_emb, metric='cosine'
)
plt.figure(figsize=(7, 7))
plt.imshow(cos_sim, cmap="inferno", interpolation="nearest")
im_ratio = cos_sim.shape[0] / cos_sim.shape[1]
plt.colorbar(fraction=0.046 * im_ratio, pad=0.04)
plt.xlabel("Position")
plt.ylabel("Position")
plt.tight_layout()
plt.plot()
plt.savefig("/content/Ultimate-Drums-Transformer-Tokens-Embeddings-Plot.png", bbox_inches="tight")
"""# (GENERATE)
# (IMPROV)
"""
#@title Standard Improv Generator
#@markdown Generation settings
melody_MIDI_patch_number = 0 # @param {type:"slider", min:0, max:127, step:1}
number_of_tokens_to_generate = 256 # @param {type:"slider", min:40, max:8192, step:4}
number_of_batches_to_generate = 4 #@param {type:"slider", min:1, max:16, step:1}
temperature = 0.9 # @param {type:"slider", min:0.1, max:1, step:0.05}
#@markdown Other settings
render_MIDI_to_audio = True # @param {type:"boolean"}
print('=' * 70)
print('Ultimate Drums Transformer Standard Improv Model Generator')
print('=' * 70)
outy = [random.randint(4, 16)]
print('Selected Improv sequence:')
print(outy)
print('=' * 70)
torch.cuda.empty_cache()
inp = [outy] * number_of_batches_to_generate
inp = torch.LongTensor(inp).cuda()
with ctx:
out = model.generate(inp,
number_of_tokens_to_generate,
temperature=temperature,
return_prime=True,
verbose=True)
out0 = out.tolist()
print('=' * 70)
print('Done!')
print('=' * 70)
torch.cuda.empty_cache()
#======================================================================
print('Rendering results...')
for i in range(number_of_batches_to_generate):
print('=' * 70)
print('Batch #', i)
print('=' * 70)
out1 = out0[i]
print('Sample INTs', out1[:12])
print('=' * 70)
if len(out1) != 0:
song = out1
song_f = []
time = 0
dtime = 0
ptime = 0
dur = 128
vel = 90
pitch = 0
channel = 0
patches = [0] * 16
patches[0] = melody_MIDI_patch_number
for ss in song:
if 0 < ss < 128:
dtime = ptime = time
time += ss * 32
song_f.append(['note', ptime, dur, 0, random.choice([60, 62, 64]), vel, melody_MIDI_patch_number])
if 128 <= ss < 256:
dtime += (ss-128) * 32
if 256 <= ss < 384:
pitch = (ss-256)
if 384 <= ss < 393:
if pitch != 0:
vel = (ss-384) * 15
song_f.append(['note', dtime, dur, 9, pitch, vel, 128])
data = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
output_signature = 'Ultimate Drums Transformer',
output_file_name = '/content/Ultimate-Drums-Transformer-Composition_'+str(i),
track_name='Project Los Angeles',
list_of_MIDI_patches=patches
)
print('=' * 70)
print('Displaying resulting composition...')
print('=' * 70)
fname = '/content/Ultimate-Drums-Transformer-Composition_'+str(i)
if render_MIDI_to_audio:
midi_audio = midi_to_colab_audio(fname + '.mid')
display(Audio(midi_audio, rate=16000, normalize=False))
TMIDIX.plot_ms_SONG(song_f, plot_title=fname)
"""# (DRUMS TRACK GENERATION)"""
#@title Load Seed MIDI
#@markdown Press play button to to upload your own seed MIDI or to load one of the provided sample seed MIDIs from the dropdown list below
select_seed_MIDI = "Upload your own custom MIDI" # @param ["Upload your own custom MIDI", "Ultimate-Drums-Transformer-Melody-Seed-1", "Ultimate-Drums-Transformer-Melody-Seed-2", "Ultimate-Drums-Transformer-Melody-Seed-3", "Ultimate-Drums-Transformer-Melody-Seed-4", "Ultimate-Drums-Transformer-Melody-Seed-5", "Ultimate-Drums-Transformer-Melody-Seed-6", "Ultimate-Drums-Transformer-MI-Seed-1", "Ultimate-Drums-Transformer-MI-Seed-2", "Ultimate-Drums-Transformer-MI-Seed-3", "Ultimate-Drums-Transformer-MI-Seed-4"]
number_of_prime_drums_chords = 0 # @param {type:"slider", min:0, max:1024, step:4}
render_MIDI_to_audio = False # @param {type:"boolean"}
#===============================================================================
print('=' * 70)
print('Ultimate Drums Transformer Seed MIDI Loader')
print('=' * 70)
f = ''
if select_seed_MIDI != "Upload your own custom MIDI":
print('Loading seed MIDI...')
f = '/content/Ultimate-Drums-Transformer/Seeds/'+select_seed_MIDI+'.mid'
else:
print('Upload your own custom MIDI...')
print('=' * 70)
uploaded_MIDI = files.upload()
if list(uploaded_MIDI.keys()):
f = list(uploaded_MIDI.keys())[0]
#===============================================================================
if f != '':
print('=' * 70)
print('File:', f)
print('=' * 70)
#=============================================================================
# START PROCESSING
#=============================================================================
raw_score = TMIDIX.midi2single_track_ms_score(f)
escore_notes = TMIDIX.advanced_score_processor(raw_score,
return_enhanced_score_notes=True
)[0]
escore_notes = [e for e in escore_notes if e[3] != 9]
escore_notes = TMIDIX.augment_enhanced_score_notes(escore_notes,
timings_divider=32
)
patches = TMIDIX.patch_list_from_enhanced_score_notes(escore_notes)
dscore = TMIDIX.delta_score_notes(escore_notes)
cscore = TMIDIX.chordify_score([d[1:] for d in dscore])
output = []
#=============================================================================
# Drums continuation
#=============================================================================
escore_notes1 = []
dt_score_notes_vel = []
dcscore1 = []
cont_score = []
if number_of_prime_drums_chords > 0:
escore_notes1 = TMIDIX.advanced_score_processor(raw_score,
return_enhanced_score_notes=True
)[0]
escore_notes1 = TMIDIX.augment_enhanced_score_notes(escore_notes1,
timings_divider=32
)
# checking number of instruments in a composition
instruments_list = list(set([y[3] for y in escore_notes1]))
if len(escore_notes1) > 0 and (9 in instruments_list):
#=======================================================================
dcscore1 = TMIDIX.chordify_score([1000, escore_notes1])
#=======================================================================
npe = dcscore1[0]
npe.sort(key=lambda x: x[4])
pe = 0
ntime = 0
pabs_time = 0
abs_time = 0
drums = True
dccount = 0
for i, d in enumerate(dcscore1[:-1]):
d.sort(key=lambda x: x[4])
dchans = sorted(set([x[3] for x in d]))
nd = dcscore1[i+1]
chans = sorted(set([x[3] for x in nd]))
time = nd[0][1] - npe[0][1]
dtime = max(0, min(127, time))
pabs_time = abs_time
abs_time += dtime
npe = nd
ndtime = max(0, min(127, (abs_time - ntime)))
if 9 in dchans and len(dchans) > 1:
drums = True
if drums:
if chans != [9]:
dt_score_notes_vel.extend([ndtime])
ntime = abs_time
pe = pabs_time
if 9 in dchans:
for e in d:
cha = e[3]
if cha == 9:
cdtime = pabs_time - pe
cdtime = max(0, min(127, int(cdtime)))
ptc = max(1, min(127, e[4]))
velocity = max(8, min(127, e[5]))
vel = round(velocity / 15)
if (abs_time - ntime) < 128:
if cdtime != 0:
dt_score_notes_vel.extend([cdtime+128, ptc+256, vel+384])
else:
dt_score_notes_vel.extend([ptc+256, vel+384])
pe = pabs_time
dccount += 1
if 9 not in dchans and drums:
dt_score_notes_vel.extend([0+256, 0+384])
if dccount == number_of_prime_drums_chords:
cont_score = dcscore1[:i]
break
#=============================================================================
if number_of_prime_drums_chords == 0 and not dt_score_notes_vel:
song_f = escore_notes
for s in song_f:
s[1] *= 32
s[2] *= 32
elif number_of_prime_drums_chords > 0 and dt_score_notes_vel:
time = 0
dur = 0
vel = 90
pitch = 0
channel = 0
song_f = []
for cs in cont_score:
time = cs[0][1] * 32
for c in cs:
dur = c[2] * 32
song_f.append(['note', time, dur, c[3], c[4], c[5], c[6]])
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
output_signature = 'Ultimate Drums Transformer',
output_file_name = '/content/Ultimate-Drums-Transformer-Seed-Composition',
track_name='Project Los Angeles',
list_of_MIDI_patches=patches
)
#=============================================================================
print('=' * 70)
print('Composition stats:')
print('Composition has', len(cscore), 'chords')
print('Composition MIDI patches:', sorted(set(patches)))
print('=' * 70)
#=============================================================================
print('Displaying resulting composition...')
print('=' * 70)
fname = '/content/Ultimate-Drums-Transformer-Seed-Composition'
if render_MIDI_to_audio:
midi_audio = midi_to_colab_audio(fname + '.mid')
display(Audio(midi_audio, rate=16000, normalize=False))
TMIDIX.plot_ms_SONG(song_f, plot_title=fname)
else:
print('=' * 70)
#@title Drums track generation
#@markdown NOTE: You can stop the generation at any time to render partial results
#@markdown Generation settings
generate_from = "Beginning" # @param ["Beginning", "Last Position", "Prime Drums Chords"]
number_of_chords_to_generate_drums_for = 128 # @param {type:"slider", min:4, max:8192, step:4}
start_chord_number = 0 # @param {type:"slider", min:0, max:1024, step:4}
max_number_of_drums_pitches_per_step = 3 # @param {type:"slider", min:1, max:16, step:1}
number_of_memory_tokens = 4096 # @param {type:"slider", min:32, max:8188, step:16}
temperature = 0.9 # @param {type:"slider", min:0.1, max:1, step:0.05}
#@markdown Other settings
render_MIDI_to_audio = True # @param {type:"boolean"}
print('=' * 70)
print('Ultimate Drums Transformer Drums Track Generator')
print('=' * 70)
#===============================================================================
def generate_drums(input_seq,
max_drums_limit = 3,
num_memory_tokens = 4096,
temperature=0.9):
input_seq = input_seq[-num_memory_tokens:]
x = torch.tensor([input_seq] * 1, dtype=torch.long, device='cuda')
o = 128
ncount = 0
time = 0
ntime = input_seq[-1]
while o > 127 and ncount < max_drums_limit and time < ntime:
with ctx:
out = model.generate(x,
1,
temperature=temperature,
return_prime=False,
verbose=False)
o = out.tolist()[0][0]
if 128 <= o < 256:
ncount = 0
time += (o-128)
if 384 < o < 393:
ncount += 1
if o > 127 and time < ntime:
x = torch.cat((x, out), 1)
return x.tolist()[0][len(input_seq):]
#===============================================================================
comp_times = [t[1] for t in dscore if t[1] != 0]
comp_times = comp_times + [comp_times[-1]]
if generate_from == 'Beginning':
print('Generating drums track...')
print('=' * 70)
output = []
torch.cuda.empty_cache()
for c in tqdm.tqdm(comp_times[:number_of_chords_to_generate_drums_for]):
try:
output.append(c)
out = generate_drums(output,
temperature=temperature,
max_drums_limit=max_number_of_drums_pitches_per_step,
num_memory_tokens=number_of_memory_tokens
)
output.extend(out)
except KeyboardInterrupt:
print('Stopping generation...')
break
except:
break
torch.cuda.empty_cache()
#===============================================================================
elif generate_from == 'Last Position':
if output:
tidxs = [i for i in range(len(output)) if output[i] < 128]
if 0 < start_chord_number < len(tidxs):
output = output[:tidxs[start_chord_number]]
if output:
pidx = sum([1 for o in output if o < 128])
else:
pidx = 0
if pidx > 0 and pidx < len(comp_times[:number_of_chords_to_generate_drums_for]):
#===============================================================================
print('Continuing generating drums track...')
print('=' * 70)
torch.cuda.empty_cache()
for c in tqdm.tqdm(comp_times[pidx:number_of_chords_to_generate_drums_for]):
try:
output.append(c)
out = generate_drums(output,
temperature=temperature,
max_drums_limit=max_number_of_drums_pitches_per_step,
num_memory_tokens=number_of_memory_tokens
)
output.extend(out)
except KeyboardInterrupt:
print('=' * 70)
print('Stopping generation...')
break
except:
break
torch.cuda.empty_cache()
else:
print('Nothing to continue!')
print('Please start from the begining...')
#===============================================================================
elif generate_from == 'Prime Drums Chords':
output = copy.deepcopy(dt_score_notes_vel)
if output:
tidxs = [i for i in range(len(output)) if output[i] < 128]
if 0 < start_chord_number < len(tidxs):
output = output[:tidxs[start_chord_number]]
if output:
pidx = sum([1 for o in output if o < 128])
else:
pidx = 0
if pidx > 0 and pidx < len(comp_times[:number_of_chords_to_generate_drums_for]):
#===============================================================================
print('Continuing generating drums track...')
print('=' * 70)
torch.cuda.empty_cache()
for c in tqdm.tqdm(comp_times[pidx:number_of_chords_to_generate_drums_for]):
try:
output.append(c)
out = generate_drums(output,
temperature=temperature,
max_drums_limit=max_number_of_drums_pitches_per_step,
num_memory_tokens=number_of_memory_tokens
)
output.extend(out)
except KeyboardInterrupt:
print('=' * 70)
print('Stopping generation...')
break
except:
break
torch.cuda.empty_cache()
else:
print('Nothing to continue!')
print('Please start from the begining...')
#===============================================================================
print('=' * 70)
print('Done!')
print('=' * 70)
#===============================================================================
print('Rendering results...')
print('=' * 70)
print('Sample INTs', output[:12])
print('=' * 70)
if len(output) != 0:
song = output
song_f = []
time = 0
dtime = 0
dur = 32
vel = 90
pitch = 0
channel = 0
for ss in song:
if 0 < ss < 128:
dtime = time
time += ss * 32
if 128 <= ss < 256:
dtime += (ss-128) * 32
if 256 <= ss < 384:
pitch = (ss-256)
if 384 <= ss < 393:
if pitch != 0:
vel = (ss-384) * 15
song_f.append(['note', dtime, dur, 9, pitch, vel, 128])
#===============================================================================
original_score = []
time = 0
pidx = sum([1 for o in output if o < 128])
for c in cscore[:pidx+1]:
for cc in c:
time += cc[0] * 32
dur = cc[1] * 32
original_note = ['note'] + copy.deepcopy(cc)
original_note[1] = time
original_note[2] = dur
original_score.append(original_note)
song_f = sorted(original_score + song_f, key=lambda x: x[1])
#===============================================================================
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
output_signature = 'Ultimate Drums Transformer',
output_file_name = '/content/Ultimate-Drums-Transformer-Composition',
track_name='Project Los Angeles',
list_of_MIDI_patches=patches
)
#=========================================================================
print('=' * 70)
print('Displaying resulting composition...')
print('=' * 70)
fname = '/content/Ultimate-Drums-Transformer-Composition'
if render_MIDI_to_audio:
midi_audio = midi_to_colab_audio(fname + '.mid')
display(Audio(midi_audio, rate=16000, normalize=False))
TMIDIX.plot_ms_SONG(song_f, plot_title=fname)
else:
print('Try again :)')
print('=' * 70)
"""# Congrats! You did it! :)"""