Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
|
@@ -6720,7 +6720,9 @@ def horizontal_ordered_list_search(list_of_lists,
|
|
| 6720 |
###################################################################################
|
| 6721 |
|
| 6722 |
def escore_notes_to_escore_matrix(escore_notes,
|
| 6723 |
-
alt_velocities=False
|
|
|
|
|
|
|
| 6724 |
):
|
| 6725 |
|
| 6726 |
last_time = escore_notes[-1][1]
|
|
@@ -6761,6 +6763,18 @@ def escore_notes_to_escore_matrix(escore_notes,
|
|
| 6761 |
|
| 6762 |
pe = note
|
| 6763 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6764 |
escore_matrixes.append(escore_matrix)
|
| 6765 |
|
| 6766 |
return [channels_list, escore_matrixes]
|
|
@@ -6849,7 +6863,9 @@ def escore_matrix_to_original_escore_notes(full_escore_matrix):
|
|
| 6849 |
|
| 6850 |
def escore_notes_to_binary_matrix(escore_notes,
|
| 6851 |
channel=0,
|
| 6852 |
-
patch=0
|
|
|
|
|
|
|
| 6853 |
):
|
| 6854 |
|
| 6855 |
escore = [e for e in escore_notes if e[3] == channel and e[6] == patch]
|
|
@@ -6882,6 +6898,18 @@ def escore_notes_to_binary_matrix(escore_notes,
|
|
| 6882 |
|
| 6883 |
escore_matrix[t][pitch] = 1
|
| 6884 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6885 |
return escore_matrix
|
| 6886 |
|
| 6887 |
else:
|
|
@@ -7904,9 +7932,7 @@ def chord_to_pchord(chord):
|
|
| 7904 |
for cc in chord:
|
| 7905 |
if cc[3] != 9:
|
| 7906 |
pchord.append(cc[4])
|
| 7907 |
-
|
| 7908 |
-
pchord.append(cc[4]+128)
|
| 7909 |
-
|
| 7910 |
return pchord
|
| 7911 |
|
| 7912 |
def summarize_escore_notes(escore_notes,
|
|
|
|
| 6720 |
###################################################################################
|
| 6721 |
|
| 6722 |
def escore_notes_to_escore_matrix(escore_notes,
|
| 6723 |
+
alt_velocities=False,
|
| 6724 |
+
flip_matrix=False,
|
| 6725 |
+
reverse_matrix=False
|
| 6726 |
):
|
| 6727 |
|
| 6728 |
last_time = escore_notes[-1][1]
|
|
|
|
| 6763 |
|
| 6764 |
pe = note
|
| 6765 |
|
| 6766 |
+
if flip_matrix:
|
| 6767 |
+
|
| 6768 |
+
temp_matrix = []
|
| 6769 |
+
|
| 6770 |
+
for m in escore_matrix:
|
| 6771 |
+
temp_matrix.append(m[::-1])
|
| 6772 |
+
|
| 6773 |
+
escore_matrix = temp_matrix
|
| 6774 |
+
|
| 6775 |
+
if reverse_matrix:
|
| 6776 |
+
escore_matrix = escore_matrix[::-1]
|
| 6777 |
+
|
| 6778 |
escore_matrixes.append(escore_matrix)
|
| 6779 |
|
| 6780 |
return [channels_list, escore_matrixes]
|
|
|
|
| 6863 |
|
| 6864 |
def escore_notes_to_binary_matrix(escore_notes,
|
| 6865 |
channel=0,
|
| 6866 |
+
patch=0,
|
| 6867 |
+
flip_matrix=False,
|
| 6868 |
+
reverse_matrix=False
|
| 6869 |
):
|
| 6870 |
|
| 6871 |
escore = [e for e in escore_notes if e[3] == channel and e[6] == patch]
|
|
|
|
| 6898 |
|
| 6899 |
escore_matrix[t][pitch] = 1
|
| 6900 |
|
| 6901 |
+
if flip_matrix:
|
| 6902 |
+
|
| 6903 |
+
temp_matrix = []
|
| 6904 |
+
|
| 6905 |
+
for m in escore_matrix:
|
| 6906 |
+
temp_matrix.append(m[::-1])
|
| 6907 |
+
|
| 6908 |
+
escore_matrix = temp_matrix
|
| 6909 |
+
|
| 6910 |
+
if reverse_matrix:
|
| 6911 |
+
escore_matrix = escore_matrix[::-1]
|
| 6912 |
+
|
| 6913 |
return escore_matrix
|
| 6914 |
|
| 6915 |
else:
|
|
|
|
| 7932 |
for cc in chord:
|
| 7933 |
if cc[3] != 9:
|
| 7934 |
pchord.append(cc[4])
|
| 7935 |
+
|
|
|
|
|
|
|
| 7936 |
return pchord
|
| 7937 |
|
| 7938 |
def summarize_escore_notes(escore_notes,
|