asigalov61 commited on
Commit
92c2bd1
·
verified ·
1 Parent(s): 2745d37

Upload TMIDIX.py

Browse files
Files changed (1) hide show
  1. TMIDIX.py +38 -35
TMIDIX.py CHANGED
@@ -15502,27 +15502,29 @@ def even_out_durations_in_escore_notes(escore_notes, min_notes_gap=0):
15502
  score = [e for e in escore_notes if e[3] != 9]
15503
  drums = [e for e in escore_notes if e[3] == 9]
15504
 
15505
- cscore = chordify_score([1000, score])
 
 
 
 
15506
 
15507
- durs = []
15508
 
15509
- for c in cscore:
15510
- durs.append([e[2] for e in c])
15511
 
15512
- ndurs = even_out_values_in_list_of_lists(durs)
15513
 
15514
- output_score = []
15515
-
15516
- for i, c in enumerate(cscore):
15517
- cc = copy.deepcopy(c)
15518
- ndur = ndurs[i]
15519
-
15520
- for j, e in enumerate(cc):
15521
- e[2] = ndur[j]
15522
-
15523
- output_score.extend(cc)
15524
 
15525
- return sorted(output_score + drums, key=lambda x: (x[1], -x[4]))
15526
 
15527
  ###################################################################################
15528
 
@@ -15531,31 +15533,32 @@ def even_out_velocities_in_escore_notes(escore_notes, use_pitches=False):
15531
  score = [e for e in escore_notes if e[3] != 9]
15532
  drums = [e for e in escore_notes if e[3] == 9]
15533
 
15534
- cscore = chordify_score([1000, score])
 
 
 
15535
 
15536
- vels = []
15537
 
15538
- for c in cscore:
15539
- if use_pitches:
15540
- vels.append([max(40, e[4]) for e in c])
15541
 
15542
- else:
15543
- vels.append([e[5] for e in c])
15544
 
15545
- nvels = even_out_values_in_list_of_lists(vels)
15546
 
15547
- output_score = []
15548
-
15549
- for i, c in enumerate(cscore):
15550
- cc = copy.deepcopy(c)
15551
- nvel = nvels[i]
15552
-
15553
- for j, e in enumerate(cc):
15554
- e[5] = nvel[j]
15555
-
15556
- output_score.extend(cc)
15557
 
15558
- return sorted(output_score + drums, key=lambda x: (x[1], -x[4]))
15559
 
15560
  ###################################################################################
15561
 
 
15502
  score = [e for e in escore_notes if e[3] != 9]
15503
  drums = [e for e in escore_notes if e[3] == 9]
15504
 
15505
+ output_score = []
15506
+
15507
+ if score:
15508
+
15509
+ cscore = chordify_score([1000, score])
15510
 
15511
+ durs = []
15512
 
15513
+ for c in cscore:
15514
+ durs.append([e[2] for e in c])
15515
 
15516
+ ndurs = even_out_values_in_list_of_lists(durs)
15517
 
15518
+ for i, c in enumerate(cscore):
15519
+ cc = copy.deepcopy(c)
15520
+ ndur = ndurs[i]
15521
+
15522
+ for j, e in enumerate(cc):
15523
+ e[2] = ndur[j]
15524
+
15525
+ output_score.extend(cc)
 
 
15526
 
15527
+ return sorted(output_score + drums, key=lambda x: (x[1], -x[4], x[6]))
15528
 
15529
  ###################################################################################
15530
 
 
15533
  score = [e for e in escore_notes if e[3] != 9]
15534
  drums = [e for e in escore_notes if e[3] == 9]
15535
 
15536
+ output_score = []
15537
+
15538
+ if score:
15539
+ cscore = chordify_score([1000, score])
15540
 
15541
+ vels = []
15542
 
15543
+ for c in cscore:
15544
+ if use_pitches:
15545
+ vels.append([max(40, e[4]) for e in c])
15546
 
15547
+ else:
15548
+ vels.append([e[5] for e in c])
15549
 
15550
+ nvels = even_out_values_in_list_of_lists(vels)
15551
 
15552
+ for i, c in enumerate(cscore):
15553
+ cc = copy.deepcopy(c)
15554
+ nvel = nvels[i]
15555
+
15556
+ for j, e in enumerate(cc):
15557
+ e[5] = nvel[j]
15558
+
15559
+ output_score.extend(cc)
 
 
15560
 
15561
+ return sorted(output_score + drums, key=lambda x: (x[1], -x[4], x[6]))
15562
 
15563
  ###################################################################################
15564