Spaces:
Running
Running
Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
|
@@ -6359,6 +6359,38 @@ def transpose_pitches(pitches, transpose_value=0):
|
|
| 6359 |
|
| 6360 |
###################################################################################
|
| 6361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6362 |
# This is the end of the TMIDI X Python module
|
| 6363 |
|
| 6364 |
###################################################################################
|
|
|
|
| 6359 |
|
| 6360 |
###################################################################################
|
| 6361 |
|
| 6362 |
+
def reverse_enhanced_score_notes(enhanced_score_notes):
|
| 6363 |
+
|
| 6364 |
+
score = recalculate_score_timings(enhanced_score_notes)
|
| 6365 |
+
|
| 6366 |
+
cscore = chordify_score([1000, score])
|
| 6367 |
+
|
| 6368 |
+
abs_dtimes = []
|
| 6369 |
+
|
| 6370 |
+
for i, t in enumerate(cscore[:-1]):
|
| 6371 |
+
abs_dtimes.append(cscore[i+1][0][1])
|
| 6372 |
+
abs_dtimes.append(cscore[-1][0][1]+cscore[-1][0][2])
|
| 6373 |
+
|
| 6374 |
+
new_dtimes = []
|
| 6375 |
+
pt = abs_dtimes[-1]
|
| 6376 |
+
|
| 6377 |
+
for t in abs_dtimes[::-1]:
|
| 6378 |
+
new_dtimes.append(abs(pt-t))
|
| 6379 |
+
pt = t
|
| 6380 |
+
|
| 6381 |
+
new_mel = copy.deepcopy(cscore[::-1])
|
| 6382 |
+
|
| 6383 |
+
time = 0
|
| 6384 |
+
|
| 6385 |
+
for i, t in enumerate(new_mel):
|
| 6386 |
+
time += new_dtimes[i]
|
| 6387 |
+
for tt in t:
|
| 6388 |
+
tt[1] = time
|
| 6389 |
+
|
| 6390 |
+
return recalculate_score_timings(flatten(new_mel))
|
| 6391 |
+
|
| 6392 |
+
###################################################################################
|
| 6393 |
+
|
| 6394 |
# This is the end of the TMIDI X Python module
|
| 6395 |
|
| 6396 |
###################################################################################
|