asigalov61 commited on
Commit
5ad824c
·
verified ·
1 Parent(s): 7594447

Upload TMIDIX.py

Browse files
Files changed (1) hide show
  1. TMIDIX.py +5 -3
TMIDIX.py CHANGED
@@ -6710,7 +6710,9 @@ def escore_notes_to_escore_matrix(escore_notes):
6710
 
6711
  ###################################################################################
6712
 
6713
- def escore_matrix_to_merged_escore_notes(escore_matrix):
 
 
6714
 
6715
  result = []
6716
 
@@ -6719,11 +6721,11 @@ def escore_matrix_to_merged_escore_notes(escore_matrix):
6719
  count = 1
6720
 
6721
  for i in range(1, len(escore_matrix)):
6722
- if escore_matrix[i][j] != [-1, -1, -1] and escore_matrix[i][j][2] == escore_matrix[i-1][j][2]:
6723
  count += 1
6724
 
6725
  else:
6726
- if count > 1:
6727
  result.append([i-count, count, j, escore_matrix[i-1][j]])
6728
 
6729
  count = 1
 
6710
 
6711
  ###################################################################################
6712
 
6713
+ def escore_matrix_to_merged_escore_notes(escore_matrix,
6714
+ max_note_duration=4000
6715
+ ):
6716
 
6717
  result = []
6718
 
 
6721
  count = 1
6722
 
6723
  for i in range(1, len(escore_matrix)):
6724
+ if escore_matrix[i][j] != [-1, -1, -1] and escore_matrix[i][j][2] == escore_matrix[i-1][j][2] and count < max_note_duration:
6725
  count += 1
6726
 
6727
  else:
6728
+ if count > 1:
6729
  result.append([i-count, count, j, escore_matrix[i-1][j]])
6730
 
6731
  count = 1