Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
|
@@ -8689,6 +8689,32 @@ def escore_notes_times_tones(escore_notes,
|
|
| 8689 |
|
| 8690 |
return [[t, to] for t, to in zip(times, tones)]
|
| 8691 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8692 |
###################################################################################
|
| 8693 |
#
|
| 8694 |
# This is the end of the TMIDI X Python module
|
|
|
|
| 8689 |
|
| 8690 |
return [[t, to] for t, to in zip(times, tones)]
|
| 8691 |
|
| 8692 |
+
###################################################################################
|
| 8693 |
+
|
| 8694 |
+
def escore_notes_middle(escore_notes,
|
| 8695 |
+
length=10,
|
| 8696 |
+
use_chords=True
|
| 8697 |
+
):
|
| 8698 |
+
|
| 8699 |
+
if use_chords:
|
| 8700 |
+
score = chordify_score([1000, escore_notes])
|
| 8701 |
+
|
| 8702 |
+
else:
|
| 8703 |
+
score = escore_notes
|
| 8704 |
+
|
| 8705 |
+
middle_idx = len(score) // 2
|
| 8706 |
+
|
| 8707 |
+
slen = min(len(score) // 2, length // 2)
|
| 8708 |
+
|
| 8709 |
+
start_idx = middle_idx - slen
|
| 8710 |
+
end_idx = middle_idx + slen
|
| 8711 |
+
|
| 8712 |
+
if use_chords:
|
| 8713 |
+
return flatten(score[start_idx:end_idx])
|
| 8714 |
+
|
| 8715 |
+
else:
|
| 8716 |
+
return score[start_idx:end_idx]
|
| 8717 |
+
|
| 8718 |
###################################################################################
|
| 8719 |
#
|
| 8720 |
# This is the end of the TMIDI X Python module
|