Spaces:
Running
Running
asigalov61
commited on
Commit
•
4de2d58
1
Parent(s):
e52c59a
Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
@@ -7000,6 +7000,40 @@ def lists_intersections(src_list, trg_list):
|
|
7000 |
|
7001 |
###################################################################################
|
7002 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7003 |
# This is the end of the TMIDI X Python module
|
7004 |
|
7005 |
###################################################################################
|
|
|
7000 |
|
7001 |
###################################################################################
|
7002 |
|
7003 |
+
def transpose_escore_notes(escore_notes,
|
7004 |
+
transpose_value=0,
|
7005 |
+
channel_index=3,
|
7006 |
+
pitches_index=4
|
7007 |
+
):
|
7008 |
+
|
7009 |
+
tr_escore_notes = copy.deepcopy(escore_notes)
|
7010 |
+
|
7011 |
+
for e in tr_escore_notes:
|
7012 |
+
if e[channel_index] != 9:
|
7013 |
+
e[pitches_index] = max(1, min(127, e[pitches_index] + transpose_value))
|
7014 |
+
|
7015 |
+
return tr_escore_notes
|
7016 |
+
|
7017 |
+
###################################################################################
|
7018 |
+
|
7019 |
+
def transpose_escore_notes_to_pitch(escore_notes,
|
7020 |
+
target_pitch_value=60,
|
7021 |
+
channel_index=3,
|
7022 |
+
pitches_index=4
|
7023 |
+
):
|
7024 |
+
|
7025 |
+
tr_escore_notes = copy.deepcopy(escore_notes)
|
7026 |
+
|
7027 |
+
transpose_delta = int(round(target_pitch_value)) - int(round(escore_notes_averages(escore_notes, return_ptcs_and_vels=True)[2]))
|
7028 |
+
|
7029 |
+
for e in tr_escore_notes:
|
7030 |
+
if e[channel_index] != 9:
|
7031 |
+
e[pitches_index] = max(1, min(127, e[pitches_index] + transpose_delta))
|
7032 |
+
|
7033 |
+
return tr_escore_notes
|
7034 |
+
|
7035 |
+
###################################################################################
|
7036 |
+
|
7037 |
# This is the end of the TMIDI X Python module
|
7038 |
|
7039 |
###################################################################################
|