Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
@@ -3866,7 +3866,7 @@ def chordify_score(score,
|
|
3866 |
return None
|
3867 |
|
3868 |
def fix_monophonic_score_durations(monophonic_score,
|
3869 |
-
|
3870 |
min_notes_dur=1
|
3871 |
):
|
3872 |
|
@@ -3880,7 +3880,7 @@ def fix_monophonic_score_durations(monophonic_score,
|
|
3880 |
nmt = monophonic_score[i+1][1]
|
3881 |
|
3882 |
if note[1]+note[2] >= nmt:
|
3883 |
-
note_dur = max(1, nmt-note[1]-
|
3884 |
else:
|
3885 |
note_dur = note[2]
|
3886 |
|
@@ -3900,7 +3900,7 @@ def fix_monophonic_score_durations(monophonic_score,
|
|
3900 |
nmt = monophonic_score[i+1][0]
|
3901 |
|
3902 |
if note[0]+note[1] >= nmt:
|
3903 |
-
note_dur = max(1, nmt-note[0]-
|
3904 |
else:
|
3905 |
note_dur = note[1]
|
3906 |
|
@@ -13095,23 +13095,23 @@ def add_expressive_melody_to_enhanced_score_notes(escore_notes,
|
|
13095 |
|
13096 |
###################################################################################
|
13097 |
|
13098 |
-
def
|
13099 |
|
13100 |
-
arr = array('H',
|
13101 |
binary_data = arr.tobytes()
|
13102 |
|
13103 |
return hashlib.md5(binary_data).hexdigest()
|
13104 |
|
13105 |
###################################################################################
|
13106 |
|
13107 |
-
def
|
13108 |
-
|
13109 |
-
|
13110 |
-
|
13111 |
-
|
13112 |
-
|
13113 |
-
|
13114 |
-
|
13115 |
|
13116 |
notes = [e for e in escore_notes if e[channels_idx] != 9]
|
13117 |
drums = [e for e in escore_notes if e[channels_idx] == 9]
|
@@ -13123,7 +13123,7 @@ def merge_escore_notes_durations(escore_notes,
|
|
13123 |
for k, g in escore_groups:
|
13124 |
if len(g) > 2:
|
13125 |
fg = fix_monophonic_score_durations(g,
|
13126 |
-
|
13127 |
min_notes_dur=min_notes_dur
|
13128 |
)
|
13129 |
merged_score.extend(fg)
|
|
|
3866 |
return None
|
3867 |
|
3868 |
def fix_monophonic_score_durations(monophonic_score,
|
3869 |
+
min_notes_gap=1,
|
3870 |
min_notes_dur=1
|
3871 |
):
|
3872 |
|
|
|
3880 |
nmt = monophonic_score[i+1][1]
|
3881 |
|
3882 |
if note[1]+note[2] >= nmt:
|
3883 |
+
note_dur = max(1, nmt-note[1]-min_notes_gap)
|
3884 |
else:
|
3885 |
note_dur = note[2]
|
3886 |
|
|
|
3900 |
nmt = monophonic_score[i+1][0]
|
3901 |
|
3902 |
if note[0]+note[1] >= nmt:
|
3903 |
+
note_dur = max(1, nmt-note[0]-min_notes_gap)
|
3904 |
else:
|
3905 |
note_dur = note[1]
|
3906 |
|
|
|
13095 |
|
13096 |
###################################################################################
|
13097 |
|
13098 |
+
def list_md5_hash(ints_list):
|
13099 |
|
13100 |
+
arr = array('H', ints_list)
|
13101 |
binary_data = arr.tobytes()
|
13102 |
|
13103 |
return hashlib.md5(binary_data).hexdigest()
|
13104 |
|
13105 |
###################################################################################
|
13106 |
|
13107 |
+
def fix_escore_notes_durations(escore_notes,
|
13108 |
+
min_notes_gap=1,
|
13109 |
+
min_notes_dur=1,
|
13110 |
+
times_idx=1,
|
13111 |
+
durs_idx=2,
|
13112 |
+
channels_idx = 3,
|
13113 |
+
pitches_idx=4
|
13114 |
+
):
|
13115 |
|
13116 |
notes = [e for e in escore_notes if e[channels_idx] != 9]
|
13117 |
drums = [e for e in escore_notes if e[channels_idx] == 9]
|
|
|
13123 |
for k, g in escore_groups:
|
13124 |
if len(g) > 2:
|
13125 |
fg = fix_monophonic_score_durations(g,
|
13126 |
+
min_notes_gap=min_notes_gap,
|
13127 |
min_notes_dur=min_notes_dur
|
13128 |
)
|
13129 |
merged_score.extend(fg)
|