Spaces:
Running
Running
Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
|
@@ -4718,6 +4718,24 @@ def extract_melody(chordified_enhanced_score,
|
|
| 4718 |
|
| 4719 |
###################################################################################
|
| 4720 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4721 |
# This is the end of the TMIDI X Python module
|
| 4722 |
|
| 4723 |
###################################################################################
|
|
|
|
| 4718 |
|
| 4719 |
###################################################################################
|
| 4720 |
|
| 4721 |
+
def flip_enhanced_score_notes(enhanced_score_notes):
|
| 4722 |
+
|
| 4723 |
+
min_pitch = min([e[4] for e in enhanced_score_notes if e[3] != 9])
|
| 4724 |
+
|
| 4725 |
+
fliped_score_pitches = [127 - e[4]for e in enhanced_score_notes if e[3] != 9]
|
| 4726 |
+
|
| 4727 |
+
delta_min_pitch = min_pitch - min([p for p in fliped_score_pitches])
|
| 4728 |
+
|
| 4729 |
+
output_score = copy.deepcopy(enhanced_score_notes)
|
| 4730 |
+
|
| 4731 |
+
for e in output_score:
|
| 4732 |
+
if e[3] != 9:
|
| 4733 |
+
e[4] = (127 - e[4]) + delta_min_pitch
|
| 4734 |
+
|
| 4735 |
+
return output_score
|
| 4736 |
+
|
| 4737 |
+
###################################################################################
|
| 4738 |
+
|
| 4739 |
# This is the end of the TMIDI X Python module
|
| 4740 |
|
| 4741 |
###################################################################################
|