asigalov61 commited on
Commit
d18afce
·
verified ·
1 Parent(s): a317d05

Upload TMIDIX.py

Browse files
Files changed (1) hide show
  1. TMIDIX.py +14 -14
TMIDIX.py CHANGED
@@ -3866,7 +3866,7 @@ def chordify_score(score,
3866
  return None
3867
 
3868
  def fix_monophonic_score_durations(monophonic_score,
3869
- notes_min_gap=1,
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]-notes_min_gap)
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]-notes_min_gap)
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 int_list_md5_hash(int_list):
13099
 
13100
- arr = array('H', int_list)
13101
  binary_data = arr.tobytes()
13102
 
13103
  return hashlib.md5(binary_data).hexdigest()
13104
 
13105
  ###################################################################################
13106
 
13107
- def merge_escore_notes_durations(escore_notes,
13108
- notes_min_gap=1,
13109
- min_notes_dur=2,
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,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
- notes_min_gap=notes_min_gap,
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)