projectlosangeles commited on
Commit
a3d482f
·
verified ·
1 Parent(s): e8c175e

Upload 7 files

Browse files
Monster-MIDI-Dataset-main.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:65b6f00e480627c897b7f93d26a5971cbedfd3613a2c3ebe867821cc5e73007d
3
- size 5810003
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a16ad46342c4cdafbedabc9606f06c7a934737888e213afc6f021098302a055
3
+ size 5811367
Monster_MIDI_Dataset_GPU_Search_and_Filter.ipynb CHANGED
@@ -74,7 +74,8 @@
74
  "#@title Install all dependencies (run only once per session)\n",
75
  "\n",
76
  "!git clone --depth 1 https://github.com/asigalov61/Monster-MIDI-Dataset\n",
77
- "!pip install huggingface_hub"
 
78
  ]
79
  },
80
  {
@@ -105,6 +106,8 @@
105
  "import statistics\n",
106
  "import shutil\n",
107
  "\n",
 
 
108
  "try:\n",
109
  " import locale\n",
110
  " locale.getpreferredencoding = lambda: \"UTF-8\"\n",
@@ -395,15 +398,7 @@
395
  " raw_score = TMIDIX.midi2single_track_ms_score(f)\n",
396
  " escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]\n",
397
  "\n",
398
- " for e in escore:\n",
399
- " e[1] = int(e[1] / 16)\n",
400
- " e[2] = int(e[2] / 16)\n",
401
- "\n",
402
- " # Sorting by patch, pitch, then by start-time\n",
403
- "\n",
404
- " escore.sort(key=lambda x: x[6])\n",
405
- " escore.sort(key=lambda x: x[4], reverse=True)\n",
406
- " escore.sort(key=lambda x: x[1])\n",
407
  "\n",
408
  " drums_offset = len(TMIDIX.ALL_CHORDS_SORTED) + 128\n",
409
  "\n",
@@ -435,7 +430,7 @@
435
  " try:\n",
436
  " sig_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128\n",
437
  " except:\n",
438
- " checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord, pitches[0])\n",
439
  " sig_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128\n",
440
  "\n",
441
  " elif len(pitches) == 1:\n",
@@ -790,15 +785,7 @@
790
  " raw_score = TMIDIX.midi2single_track_ms_score(f)\n",
791
  " escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]\n",
792
  "\n",
793
- " for e in escore:\n",
794
- " e[1] = int(e[1] / 16)\n",
795
- " e[2] = int(e[2] / 16)\n",
796
- "\n",
797
- " # Sorting by patch, pitch, then by start-time\n",
798
- "\n",
799
- " escore.sort(key=lambda x: x[6])\n",
800
- " escore.sort(key=lambda x: x[4], reverse=True)\n",
801
- " escore.sort(key=lambda x: x[1])\n",
802
  "\n",
803
  " src_kilo_chords = []\n",
804
  "\n",
@@ -824,7 +811,7 @@
824
  " try:\n",
825
  " chord_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128\n",
826
  " except:\n",
827
- " checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord, pitches[0])\n",
828
  " chord_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128\n",
829
  "\n",
830
  " elif len(pitches) == 1:\n",
 
74
  "#@title Install all dependencies (run only once per session)\n",
75
  "\n",
76
  "!git clone --depth 1 https://github.com/asigalov61/Monster-MIDI-Dataset\n",
77
+ "!pip install huggingface_hub\n",
78
+ "!pip install hf_transfer"
79
  ]
80
  },
81
  {
 
106
  "import statistics\n",
107
  "import shutil\n",
108
  "\n",
109
+ "os.environ[\"HF_HUB_ENABLE_HF_TRANSFER\"] = \"1\"\n",
110
+ "\n",
111
  "try:\n",
112
  " import locale\n",
113
  " locale.getpreferredencoding = lambda: \"UTF-8\"\n",
 
398
  " raw_score = TMIDIX.midi2single_track_ms_score(f)\n",
399
  " escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]\n",
400
  "\n",
401
+ " escore = TMIDIX.augment_enhanced_score_notes(escore)\n",
 
 
 
 
 
 
 
 
402
  "\n",
403
  " drums_offset = len(TMIDIX.ALL_CHORDS_SORTED) + 128\n",
404
  "\n",
 
430
  " try:\n",
431
  " sig_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128\n",
432
  " except:\n",
433
+ " checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord)\n",
434
  " sig_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128\n",
435
  "\n",
436
  " elif len(pitches) == 1:\n",
 
785
  " raw_score = TMIDIX.midi2single_track_ms_score(f)\n",
786
  " escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]\n",
787
  "\n",
788
+ " escore = TMIDIX.augment_enhanced_score_notes(escore)\n",
 
 
 
 
 
 
 
 
789
  "\n",
790
  " src_kilo_chords = []\n",
791
  "\n",
 
811
  " try:\n",
812
  " chord_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128\n",
813
  " except:\n",
814
+ " checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord)\n",
815
  " chord_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128\n",
816
  "\n",
817
  " elif len(pitches) == 1:\n",
TMIDIX.py CHANGED
@@ -4690,7 +4690,8 @@ def augment_enhanced_score_notes(enhanced_score_notes,
4690
  pitch_shift=0,
4691
  ceil_timings=False,
4692
  round_timings=False,
4693
- legacy_timings=True
 
4694
  ):
4695
 
4696
  esn = copy.deepcopy(enhanced_score_notes)
@@ -4740,6 +4741,9 @@ def augment_enhanced_score_notes(enhanced_score_notes,
4740
  esn.sort(key=lambda x: x[6])
4741
  esn.sort(key=lambda x: x[4], reverse=True)
4742
  esn.sort(key=lambda x: x[1])
 
 
 
4743
 
4744
  return esn
4745
 
@@ -7883,19 +7887,21 @@ def solo_piano_escore_notes(escore_notes,
7883
  chord = []
7884
 
7885
  for cc in c:
7886
- if cc[pitches_index] not in seen:
7887
 
7888
- if cc[channels_index] != 9:
 
 
7889
  cc[channels_index] = 0
7890
  cc[patches_index] = 0
7891
-
7892
  chord.append(cc)
7893
  seen.append(cc[pitches_index])
7894
-
7895
- else:
7896
- if keep_drums:
 
7897
  chord.append(cc)
7898
- seen.append(cc[pitches_index])
7899
 
7900
  sp_escore_notes.append(chord)
7901
 
@@ -9254,6 +9260,127 @@ def find_highest_density_escore_notes_chunk(escore_notes, max_chunk_time=512):
9254
 
9255
  return chunk_escore
9256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9257
  ###################################################################################
9258
  #
9259
  # This is the end of the TMIDI X Python module
 
4690
  pitch_shift=0,
4691
  ceil_timings=False,
4692
  round_timings=False,
4693
+ legacy_timings=True,
4694
+ sort_drums_last=False
4695
  ):
4696
 
4697
  esn = copy.deepcopy(enhanced_score_notes)
 
4741
  esn.sort(key=lambda x: x[6])
4742
  esn.sort(key=lambda x: x[4], reverse=True)
4743
  esn.sort(key=lambda x: x[1])
4744
+
4745
+ if sort_drums_last:
4746
+ esn.sort(key=lambda x: (x[1], -x[4], x[6]) if x[6] != 128 else (x[1], x[6], -x[4]))
4747
 
4748
  return esn
4749
 
 
7887
  chord = []
7888
 
7889
  for cc in c:
 
7890
 
7891
+ if cc[channels_index] != 9:
7892
+ if cc[pitches_index] not in seen:
7893
+
7894
  cc[channels_index] = 0
7895
  cc[patches_index] = 0
7896
+
7897
  chord.append(cc)
7898
  seen.append(cc[pitches_index])
7899
+
7900
+ else:
7901
+ if keep_drums:
7902
+ if cc[pitches_index]+128 not in seen:
7903
  chord.append(cc)
7904
+ seen.append(cc[pitches_index]+128)
7905
 
7906
  sp_escore_notes.append(chord)
7907
 
 
9260
 
9261
  return chunk_escore
9262
 
9263
+ ###################################################################################
9264
+
9265
+ def advanced_add_drums_to_escore_notes(escore_notes,
9266
+ main_beat_min_dtime=5,
9267
+ main_beat_dtime_thres=1,
9268
+ drums_durations_value=2,
9269
+ drums_pitches_velocities=[(36, 100),
9270
+ (38, 100),
9271
+ (41, 125)],
9272
+ recalculate_score_timings=True,
9273
+ intro_drums_count=4,
9274
+ intro_drums_time_k=4,
9275
+ intro_drums_pitch_velocity=[37, 110]
9276
+ ):
9277
+
9278
+ #===========================================================
9279
+
9280
+ new_dscore = delta_score_notes(escore_notes)
9281
+
9282
+ times = [d[1] for d in new_dscore if d[1] != 0]
9283
+
9284
+ time = [c[0] for c in Counter(times).most_common() if c[0] >= main_beat_min_dtime][0]
9285
+
9286
+ #===========================================================
9287
+
9288
+ if intro_drums_count > 0:
9289
+
9290
+ drums_score = []
9291
+
9292
+ for i in range(intro_drums_count):
9293
+
9294
+ if i == 0:
9295
+ dtime = 0
9296
+
9297
+ else:
9298
+ dtime = time
9299
+
9300
+ drums_score.append(['note',
9301
+ dtime * intro_drums_time_k,
9302
+ drums_durations_value,
9303
+ 9,
9304
+ intro_drums_pitch_velocity[0],
9305
+ intro_drums_pitch_velocity[1],
9306
+ 128]
9307
+ )
9308
+
9309
+ new_dscore[0][1] = time * intro_drums_time_k
9310
+
9311
+ new_dscore = drums_score + new_dscore
9312
+
9313
+ #===========================================================
9314
+
9315
+ for e in new_dscore:
9316
+
9317
+ if abs(e[1] - time) == main_beat_dtime_thres:
9318
+ e[1] = time
9319
+
9320
+ if recalculate_score_timings:
9321
+
9322
+ if e[1] % time != 0 and e[1] > time:
9323
+ if e[1] % time < time // 2:
9324
+ e[1] -= e[1] % time
9325
+
9326
+ else:
9327
+ e[1] += time - (e[1] % time)
9328
+
9329
+ #===========================================================
9330
+
9331
+ drums_score = []
9332
+
9333
+ dtime = 0
9334
+
9335
+ idx = 0
9336
+
9337
+ for i, e in enumerate(new_dscore):
9338
+
9339
+ drums_score.append(e)
9340
+
9341
+ dtime += e[1]
9342
+
9343
+ if e[1] != 0:
9344
+ idx += 1
9345
+
9346
+ if i >= intro_drums_count:
9347
+
9348
+ if (e[1] % time == 0 and e[1] != 0) or i == 0:
9349
+
9350
+ if idx % 2 == 0 and e[1] != 0:
9351
+ drums_score.append(['note',
9352
+ 0,
9353
+ drums_durations_value,
9354
+ 9,
9355
+ drums_pitches_velocities[0][0],
9356
+ drums_pitches_velocities[0][1],
9357
+ 128]
9358
+ )
9359
+
9360
+ if idx % 2 != 0 and e[1] != 0:
9361
+ drums_score.append(['note',
9362
+ 0,
9363
+ drums_durations_value,
9364
+ 9,
9365
+ drums_pitches_velocities[1][0],
9366
+ drums_pitches_velocities[1][1],
9367
+ 128]
9368
+ )
9369
+
9370
+ if idx % 4 == 0 and e[1] != 0:
9371
+ drums_score.append(['note',
9372
+ 0,
9373
+ drums_durations_value,
9374
+ 9,
9375
+ drums_pitches_velocities[2][0],
9376
+ drums_pitches_velocities[2][1],
9377
+ 128]
9378
+ )
9379
+
9380
+ #===========================================================
9381
+
9382
+ return delta_score_to_abs_score(drums_score)
9383
+
9384
  ###################################################################################
9385
  #
9386
  # This is the end of the TMIDI X Python module
fluidsynth-master.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f16ae34ae87eeb54fef8b8c62579ef39c0b5f3b7094813bd9602812f817f31be
3
- size 1965503
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d67bb7863cc8b2c927c7f726ff8f5344ac875650a00c522939caa0e03bc2209
3
+ size 1960774
monster_midi_dataset_gpu_search_and_filter.py CHANGED
@@ -32,6 +32,7 @@ Powered by tegridy-tools: https://github.com/asigalov61/tegridy-tools
32
 
33
  !git clone --depth 1 https://github.com/asigalov61/Monster-MIDI-Dataset
34
  !pip install huggingface_hub
 
35
 
36
  #@title Import all needed modules
37
 
@@ -47,6 +48,8 @@ import pprint
47
  import statistics
48
  import shutil
49
 
 
 
50
  try:
51
  import locale
52
  locale.getpreferredencoding = lambda: "UTF-8"
@@ -268,15 +271,7 @@ if filez:
268
  raw_score = TMIDIX.midi2single_track_ms_score(f)
269
  escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
270
 
271
- for e in escore:
272
- e[1] = int(e[1] / 16)
273
- e[2] = int(e[2] / 16)
274
-
275
- # Sorting by patch, pitch, then by start-time
276
-
277
- escore.sort(key=lambda x: x[6])
278
- escore.sort(key=lambda x: x[4], reverse=True)
279
- escore.sort(key=lambda x: x[1])
280
 
281
  drums_offset = len(TMIDIX.ALL_CHORDS_SORTED) + 128
282
 
@@ -308,7 +303,7 @@ if filez:
308
  try:
309
  sig_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128
310
  except:
311
- checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord, pitches[0])
312
  sig_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128
313
 
314
  elif len(pitches) == 1:
@@ -636,15 +631,7 @@ if filez:
636
  raw_score = TMIDIX.midi2single_track_ms_score(f)
637
  escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
638
 
639
- for e in escore:
640
- e[1] = int(e[1] / 16)
641
- e[2] = int(e[2] / 16)
642
-
643
- # Sorting by patch, pitch, then by start-time
644
-
645
- escore.sort(key=lambda x: x[6])
646
- escore.sort(key=lambda x: x[4], reverse=True)
647
- escore.sort(key=lambda x: x[1])
648
 
649
  src_kilo_chords = []
650
 
@@ -670,7 +657,7 @@ if filez:
670
  try:
671
  chord_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128
672
  except:
673
- checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord, pitches[0])
674
  chord_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128
675
 
676
  elif len(pitches) == 1:
 
32
 
33
  !git clone --depth 1 https://github.com/asigalov61/Monster-MIDI-Dataset
34
  !pip install huggingface_hub
35
+ !pip install hf_transfer
36
 
37
  #@title Import all needed modules
38
 
 
48
  import statistics
49
  import shutil
50
 
51
+ os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
52
+
53
  try:
54
  import locale
55
  locale.getpreferredencoding = lambda: "UTF-8"
 
271
  raw_score = TMIDIX.midi2single_track_ms_score(f)
272
  escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
273
 
274
+ escore = TMIDIX.augment_enhanced_score_notes(escore)
 
 
 
 
 
 
 
 
275
 
276
  drums_offset = len(TMIDIX.ALL_CHORDS_SORTED) + 128
277
 
 
303
  try:
304
  sig_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128
305
  except:
306
+ checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord)
307
  sig_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128
308
 
309
  elif len(pitches) == 1:
 
631
  raw_score = TMIDIX.midi2single_track_ms_score(f)
632
  escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
633
 
634
+ escore = TMIDIX.augment_enhanced_score_notes(escore)
 
 
 
 
 
 
 
 
635
 
636
  src_kilo_chords = []
637
 
 
657
  try:
658
  chord_token = TMIDIX.ALL_CHORDS_SORTED.index(tones_chord) + 128
659
  except:
660
+ checked_tones_chord = TMIDIX.advanced_check_and_fix_tones_chord(tones_chord)
661
  chord_token = TMIDIX.ALL_CHORDS_SORTED.index(checked_tones_chord) + 128
662
 
663
  elif len(pitches) == 1: