Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
c6ee9c1
1
Parent(s):
56ea550
Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
@@ -1484,6 +1484,7 @@ from abc import ABC, abstractmethod
|
|
1484 |
from difflib import SequenceMatcher as SM
|
1485 |
|
1486 |
import statistics
|
|
|
1487 |
|
1488 |
import matplotlib.pyplot as plt
|
1489 |
|
@@ -1761,7 +1762,8 @@ def plot_ms_SONG(ms_song,
|
|
1761 |
plot_size=(11,4),
|
1762 |
note_height = 0.75,
|
1763 |
show_grid_lines=False,
|
1764 |
-
return_plt = False
|
|
|
1765 |
):
|
1766 |
|
1767 |
'''Tegridy ms SONG plotter/vizualizer'''
|
@@ -1774,15 +1776,15 @@ def plot_ms_SONG(ms_song,
|
|
1774 |
|
1775 |
else:
|
1776 |
|
1777 |
-
start_times = [s[1] / 1000 for s in notes]
|
1778 |
-
durations = [s[2] / 1000 for s in notes]
|
1779 |
pitches = [s[4] for s in notes]
|
1780 |
patches = [s[6] for s in notes]
|
1781 |
|
1782 |
colors = generate_colors(max_num_colors)
|
1783 |
colors[drums_color_num] = (1, 1, 1)
|
1784 |
|
1785 |
-
pbl = notes[preview_length_in_notes][1] / 1000
|
1786 |
|
1787 |
fig, ax = plt.subplots(figsize=plot_size)
|
1788 |
#fig, ax = plt.subplots()
|
@@ -1927,7 +1929,7 @@ def Tegridy_Any_Pickle_File_Writer(Data, input_file_name='TMIDI_Pickle_File'):
|
|
1927 |
|
1928 |
###################################################################################
|
1929 |
|
1930 |
-
def Tegridy_Any_Pickle_File_Reader(input_file_name='TMIDI_Pickle_File', ext='.pickle'):
|
1931 |
|
1932 |
'''Tegridy Pickle File Loader
|
1933 |
|
@@ -1939,12 +1941,16 @@ def Tegridy_Any_Pickle_File_Reader(input_file_name='TMIDI_Pickle_File', ext='.pi
|
|
1939 |
Project Los Angeles
|
1940 |
Tegridy Code 2021'''
|
1941 |
|
1942 |
-
|
1943 |
-
|
|
|
1944 |
|
1945 |
with open(input_file_name + ext, 'rb') as pickle_file:
|
1946 |
content = pickle.load(pickle_file)
|
1947 |
|
|
|
|
|
|
|
1948 |
return content
|
1949 |
|
1950 |
###################################################################################
|
@@ -5091,6 +5097,1943 @@ def delta_score_notes(score_notes,
|
|
5091 |
|
5092 |
###################################################################################
|
5093 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5094 |
# This is the end of the TMIDI X Python module
|
5095 |
|
5096 |
###################################################################################
|
|
|
1484 |
from difflib import SequenceMatcher as SM
|
1485 |
|
1486 |
import statistics
|
1487 |
+
import math
|
1488 |
|
1489 |
import matplotlib.pyplot as plt
|
1490 |
|
|
|
1762 |
plot_size=(11,4),
|
1763 |
note_height = 0.75,
|
1764 |
show_grid_lines=False,
|
1765 |
+
return_plt = False,
|
1766 |
+
timings_multiplier=1
|
1767 |
):
|
1768 |
|
1769 |
'''Tegridy ms SONG plotter/vizualizer'''
|
|
|
1776 |
|
1777 |
else:
|
1778 |
|
1779 |
+
start_times = [(s[1] * timings_multiplier) / 1000 for s in notes]
|
1780 |
+
durations = [(s[2] * timings_multiplier) / 1000 for s in notes]
|
1781 |
pitches = [s[4] for s in notes]
|
1782 |
patches = [s[6] for s in notes]
|
1783 |
|
1784 |
colors = generate_colors(max_num_colors)
|
1785 |
colors[drums_color_num] = (1, 1, 1)
|
1786 |
|
1787 |
+
pbl = (notes[preview_length_in_notes][1] * timings_multiplier) / 1000
|
1788 |
|
1789 |
fig, ax = plt.subplots(figsize=plot_size)
|
1790 |
#fig, ax = plt.subplots()
|
|
|
1929 |
|
1930 |
###################################################################################
|
1931 |
|
1932 |
+
def Tegridy_Any_Pickle_File_Reader(input_file_name='TMIDI_Pickle_File', ext='.pickle', verbose=True):
|
1933 |
|
1934 |
'''Tegridy Pickle File Loader
|
1935 |
|
|
|
1941 |
Project Los Angeles
|
1942 |
Tegridy Code 2021'''
|
1943 |
|
1944 |
+
if verbose:
|
1945 |
+
print('Tegridy Pickle File Loader')
|
1946 |
+
print('Loading the pickle file. Please wait...')
|
1947 |
|
1948 |
with open(input_file_name + ext, 'rb') as pickle_file:
|
1949 |
content = pickle.load(pickle_file)
|
1950 |
|
1951 |
+
if verbose:
|
1952 |
+
print('Done!')
|
1953 |
+
|
1954 |
return content
|
1955 |
|
1956 |
###################################################################################
|
|
|
5097 |
|
5098 |
###################################################################################
|
5099 |
|
5100 |
+
def check_and_fix_chords_in_chordified_score(chordified_score,
|
5101 |
+
channels_index=3,
|
5102 |
+
pitches_index=4
|
5103 |
+
):
|
5104 |
+
fixed_chordified_score = []
|
5105 |
+
|
5106 |
+
bad_chords_counter = 0
|
5107 |
+
|
5108 |
+
for c in chordified_score:
|
5109 |
+
|
5110 |
+
tones_chord = sorted(set([t[pitches_index] % 12 for t in c if t[channels_index] != 9]))
|
5111 |
+
|
5112 |
+
if tones_chord:
|
5113 |
+
|
5114 |
+
if tones_chord not in ALL_CHORDS_SORTED:
|
5115 |
+
bad_chords_counter += 1
|
5116 |
+
|
5117 |
+
while tones_chord not in ALL_CHORDS_SORTED:
|
5118 |
+
tones_chord.pop(0)
|
5119 |
+
|
5120 |
+
new_chord = []
|
5121 |
+
|
5122 |
+
c.sort(key = lambda x: x[pitches_index], reverse=True)
|
5123 |
+
|
5124 |
+
for e in c:
|
5125 |
+
if e[channels_index] != 9:
|
5126 |
+
if e[pitches_index] % 12 in tones_chord:
|
5127 |
+
new_chord.append(e)
|
5128 |
+
|
5129 |
+
else:
|
5130 |
+
new_chord.append(e)
|
5131 |
+
|
5132 |
+
fixed_chordified_score.append(new_chord)
|
5133 |
+
|
5134 |
+
return fixed_chordified_score, bad_chords_counter
|
5135 |
+
|
5136 |
+
###################################################################################
|
5137 |
+
|
5138 |
+
from itertools import combinations, groupby
|
5139 |
+
|
5140 |
+
###################################################################################
|
5141 |
+
|
5142 |
+
def advanced_check_and_fix_chords_in_chordified_score(chordified_score,
|
5143 |
+
channels_index=3,
|
5144 |
+
pitches_index=4,
|
5145 |
+
patches_index=6,
|
5146 |
+
use_filtered_chords=True,
|
5147 |
+
remove_duplicate_pitches=True,
|
5148 |
+
skip_drums=False
|
5149 |
+
):
|
5150 |
+
fixed_chordified_score = []
|
5151 |
+
|
5152 |
+
bad_chords_counter = 0
|
5153 |
+
duplicate_pitches_counter = 0
|
5154 |
+
|
5155 |
+
if use_filtered_chords:
|
5156 |
+
CHORDS = ALL_CHORDS_FILTERED
|
5157 |
+
else:
|
5158 |
+
CHORDS = ALL_CHORDS_SORTED
|
5159 |
+
|
5160 |
+
for c in chordified_score:
|
5161 |
+
|
5162 |
+
if remove_duplicate_pitches:
|
5163 |
+
|
5164 |
+
c.sort(key = lambda x: x[pitches_index], reverse=True)
|
5165 |
+
|
5166 |
+
seen = set()
|
5167 |
+
ddchord = []
|
5168 |
+
|
5169 |
+
for cc in c:
|
5170 |
+
if cc[channels_index] != 9:
|
5171 |
+
|
5172 |
+
if tuple([cc[pitches_index], cc[patches_index]]) not in seen:
|
5173 |
+
ddchord.append(cc)
|
5174 |
+
seen.add(tuple([cc[pitches_index], cc[patches_index]]))
|
5175 |
+
else:
|
5176 |
+
duplicate_pitches_counter += 1
|
5177 |
+
|
5178 |
+
else:
|
5179 |
+
ddchord.append(cc)
|
5180 |
+
|
5181 |
+
c = copy.deepcopy(ddchord)
|
5182 |
+
|
5183 |
+
tones_chord = sorted(set([t[pitches_index] % 12 for t in c if t[channels_index] != 9]))
|
5184 |
+
|
5185 |
+
if tones_chord:
|
5186 |
+
|
5187 |
+
if tones_chord not in CHORDS:
|
5188 |
+
|
5189 |
+
pitches_chord = sorted(set([p[pitches_index] for p in c if p[channels_index] != 9]), reverse=True)
|
5190 |
+
|
5191 |
+
if len(tones_chord) == 2:
|
5192 |
+
tones_counts = Counter([p % 12 for p in pitches_chord]).most_common()
|
5193 |
+
|
5194 |
+
if tones_counts[0][1] > 1:
|
5195 |
+
tones_chord = [tones_counts[0][0]]
|
5196 |
+
elif tones_counts[1][1] > 1:
|
5197 |
+
tones_chord = [tones_counts[1][0]]
|
5198 |
+
else:
|
5199 |
+
tones_chord = [pitches_chord[0] % 12]
|
5200 |
+
|
5201 |
+
else:
|
5202 |
+
tones_chord_combs = [list(comb) for i in range(len(tones_chord)-2, 0, -1) for comb in combinations(tones_chord, i+1)]
|
5203 |
+
|
5204 |
+
for co in tones_chord_combs:
|
5205 |
+
if co in CHORDS:
|
5206 |
+
tones_chord = co
|
5207 |
+
break
|
5208 |
+
|
5209 |
+
bad_chords_counter += 1
|
5210 |
+
|
5211 |
+
new_chord = []
|
5212 |
+
|
5213 |
+
c.sort(key = lambda x: x[pitches_index], reverse=True)
|
5214 |
+
|
5215 |
+
for e in c:
|
5216 |
+
if e[channels_index] != 9:
|
5217 |
+
if e[pitches_index] % 12 in tones_chord:
|
5218 |
+
new_chord.append(e)
|
5219 |
+
|
5220 |
+
else:
|
5221 |
+
if not skip_drums:
|
5222 |
+
new_chord.append(e)
|
5223 |
+
|
5224 |
+
fixed_chordified_score.append(new_chord)
|
5225 |
+
|
5226 |
+
return fixed_chordified_score, bad_chords_counter, duplicate_pitches_counter
|
5227 |
+
|
5228 |
+
###################################################################################
|
5229 |
+
|
5230 |
+
def score_chord_to_tones_chord(chord,
|
5231 |
+
transpose_value=0,
|
5232 |
+
channels_index=3,
|
5233 |
+
pitches_index=4):
|
5234 |
+
|
5235 |
+
return sorted(set([(p[4]+transpose_value) % 12 for p in chord if p[channels_index] != 9]))
|
5236 |
+
|
5237 |
+
###################################################################################
|
5238 |
+
|
5239 |
+
def grouped_set(seq):
|
5240 |
+
return [k for k, v in groupby(seq)]
|
5241 |
+
|
5242 |
+
###################################################################################
|
5243 |
+
|
5244 |
+
def ordered_set(seq):
|
5245 |
+
dic = {}
|
5246 |
+
return [k for k, v in dic.fromkeys(seq).items()]
|
5247 |
+
|
5248 |
+
###################################################################################
|
5249 |
+
|
5250 |
+
def add_melody_to_enhanced_score_notes(enhanced_score_notes,
|
5251 |
+
melody_start_time=0,
|
5252 |
+
melody_start_chord=0,
|
5253 |
+
melody_notes_min_duration=-1,
|
5254 |
+
melody_notes_max_duration=255,
|
5255 |
+
melody_duration_overlap_tolerance=4,
|
5256 |
+
melody_avg_duration_divider=2,
|
5257 |
+
melody_base_octave=5,
|
5258 |
+
melody_channel=3,
|
5259 |
+
melody_patch=40,
|
5260 |
+
melody_max_velocity=110,
|
5261 |
+
acc_max_velocity=90,
|
5262 |
+
pass_drums=True
|
5263 |
+
):
|
5264 |
+
|
5265 |
+
if pass_drums:
|
5266 |
+
score = copy.deepcopy(enhanced_score_notes)
|
5267 |
+
else:
|
5268 |
+
score = [e for e in copy.deepcopy(enhanced_score_notes) if e[3] !=9]
|
5269 |
+
|
5270 |
+
if melody_notes_min_duration > 0:
|
5271 |
+
min_duration = melody_notes_min_duration
|
5272 |
+
else:
|
5273 |
+
durs = [d[2] for d in score]
|
5274 |
+
min_duration = Counter(durs).most_common()[0][0]
|
5275 |
+
|
5276 |
+
adjust_score_velocities(score, acc_max_velocity)
|
5277 |
+
|
5278 |
+
cscore = chordify_score([1000, score])
|
5279 |
+
|
5280 |
+
melody_score = []
|
5281 |
+
acc_score = []
|
5282 |
+
|
5283 |
+
pt = melody_start_time
|
5284 |
+
|
5285 |
+
for c in cscore[:melody_start_chord]:
|
5286 |
+
acc_score.extend(c)
|
5287 |
+
|
5288 |
+
for c in cscore[melody_start_chord:]:
|
5289 |
+
|
5290 |
+
durs = [d[2] if d[3] != 9 else -1 for d in c]
|
5291 |
+
|
5292 |
+
if not all(d == -1 for d in durs):
|
5293 |
+
ndurs = [d for d in durs if d != -1]
|
5294 |
+
avg_dur = (sum(ndurs) / len(ndurs)) / melody_avg_duration_divider
|
5295 |
+
best_dur = min(durs, key=lambda x:abs(x-avg_dur))
|
5296 |
+
pidx = durs.index(best_dur)
|
5297 |
+
|
5298 |
+
cc = copy.deepcopy(c[pidx])
|
5299 |
+
|
5300 |
+
if c[0][1] >= pt - melody_duration_overlap_tolerance and best_dur >= min_duration:
|
5301 |
+
|
5302 |
+
cc[3] = melody_channel
|
5303 |
+
cc[4] = (c[pidx][4] % 24)
|
5304 |
+
cc[5] = 100 + ((c[pidx][4] % 12) * 2)
|
5305 |
+
cc[6] = melody_patch
|
5306 |
+
|
5307 |
+
melody_score.append(cc)
|
5308 |
+
acc_score.extend(c)
|
5309 |
+
|
5310 |
+
pt = c[0][1]+c[pidx][2]
|
5311 |
+
|
5312 |
+
else:
|
5313 |
+
acc_score.extend(c)
|
5314 |
+
|
5315 |
+
else:
|
5316 |
+
acc_score.extend(c)
|
5317 |
+
|
5318 |
+
values = [e[4] % 24 for e in melody_score]
|
5319 |
+
smoothed = [values[0]]
|
5320 |
+
for i in range(1, len(values)):
|
5321 |
+
if abs(smoothed[-1] - values[i]) >= 12:
|
5322 |
+
if smoothed[-1] < values[i]:
|
5323 |
+
smoothed.append(values[i] - 12)
|
5324 |
+
else:
|
5325 |
+
smoothed.append(values[i] + 12)
|
5326 |
+
else:
|
5327 |
+
smoothed.append(values[i])
|
5328 |
+
|
5329 |
+
smoothed_melody = copy.deepcopy(melody_score)
|
5330 |
+
|
5331 |
+
for i, e in enumerate(smoothed_melody):
|
5332 |
+
e[4] = (melody_base_octave * 12) + smoothed[i]
|
5333 |
+
|
5334 |
+
for i, m in enumerate(smoothed_melody[1:]):
|
5335 |
+
if m[1] - smoothed_melody[i][1] < melody_notes_max_duration:
|
5336 |
+
smoothed_melody[i][2] = m[1] - smoothed_melody[i][1]
|
5337 |
+
|
5338 |
+
adjust_score_velocities(smoothed_melody, melody_max_velocity)
|
5339 |
+
|
5340 |
+
final_score = sorted(smoothed_melody + acc_score, key=lambda x: (x[1], -x[4]))
|
5341 |
+
|
5342 |
+
return final_score
|
5343 |
+
|
5344 |
+
###################################################################################
|
5345 |
+
|
5346 |
+
def find_paths(list_of_lists, path=[]):
|
5347 |
+
if not list_of_lists:
|
5348 |
+
return [path]
|
5349 |
+
return [p for sublist in list_of_lists[0] for p in find_paths(list_of_lists[1:], path+[sublist])]
|
5350 |
+
|
5351 |
+
###################################################################################
|
5352 |
+
|
5353 |
+
def recalculate_score_timings(score, start_time=0):
|
5354 |
+
|
5355 |
+
rscore = copy.deepcopy(score)
|
5356 |
+
|
5357 |
+
pe = rscore[0]
|
5358 |
+
|
5359 |
+
abs_time = start_time
|
5360 |
+
|
5361 |
+
for e in rscore:
|
5362 |
+
|
5363 |
+
dtime = e[1] - pe[1]
|
5364 |
+
pe = copy.deepcopy(e)
|
5365 |
+
abs_time += dtime
|
5366 |
+
e[1] = abs_time
|
5367 |
+
|
5368 |
+
return rscore
|
5369 |
+
|
5370 |
+
###################################################################################
|
5371 |
+
|
5372 |
+
WHITE_NOTES = [0, 2, 4, 5, 7, 9, 11]
|
5373 |
+
BLACK_NOTES = [1, 3, 6, 8, 10]
|
5374 |
+
|
5375 |
+
###################################################################################
|
5376 |
+
|
5377 |
+
ALL_CHORDS_FILTERED = [[0], [0, 3], [0, 3, 5], [0, 3, 5, 8], [0, 3, 5, 9], [0, 3, 5, 10], [0, 3, 7],
|
5378 |
+
[0, 3, 7, 10], [0, 3, 8], [0, 3, 9], [0, 3, 10], [0, 4], [0, 4, 6],
|
5379 |
+
[0, 4, 6, 9], [0, 4, 6, 10], [0, 4, 7], [0, 4, 7, 10], [0, 4, 8], [0, 4, 9],
|
5380 |
+
[0, 4, 10], [0, 5], [0, 5, 8], [0, 5, 9], [0, 5, 10], [0, 6], [0, 6, 9],
|
5381 |
+
[0, 6, 10], [0, 7], [0, 7, 10], [0, 8], [0, 9], [0, 10], [1], [1, 4],
|
5382 |
+
[1, 4, 6], [1, 4, 6, 9], [1, 4, 6, 10], [1, 4, 6, 11], [1, 4, 7],
|
5383 |
+
[1, 4, 7, 10], [1, 4, 7, 11], [1, 4, 8], [1, 4, 8, 11], [1, 4, 9], [1, 4, 10],
|
5384 |
+
[1, 4, 11], [1, 5], [1, 5, 8], [1, 5, 8, 11], [1, 5, 9], [1, 5, 10],
|
5385 |
+
[1, 5, 11], [1, 6], [1, 6, 9], [1, 6, 10], [1, 6, 11], [1, 7], [1, 7, 10],
|
5386 |
+
[1, 7, 11], [1, 8], [1, 8, 11], [1, 9], [1, 10], [1, 11], [2], [2, 5],
|
5387 |
+
[2, 5, 8], [2, 5, 8, 11], [2, 5, 9], [2, 5, 10], [2, 5, 11], [2, 6], [2, 6, 9],
|
5388 |
+
[2, 6, 10], [2, 6, 11], [2, 7], [2, 7, 10], [2, 7, 11], [2, 8], [2, 8, 11],
|
5389 |
+
[2, 9], [2, 10], [2, 11], [3], [3, 5], [3, 5, 8], [3, 5, 8, 11], [3, 5, 9],
|
5390 |
+
[3, 5, 10], [3, 5, 11], [3, 7], [3, 7, 10], [3, 7, 11], [3, 8], [3, 8, 11],
|
5391 |
+
[3, 9], [3, 10], [3, 11], [4], [4, 6], [4, 6, 9], [4, 6, 10], [4, 6, 11],
|
5392 |
+
[4, 7], [4, 7, 10], [4, 7, 11], [4, 8], [4, 8, 11], [4, 9], [4, 10], [4, 11],
|
5393 |
+
[5], [5, 8], [5, 8, 11], [5, 9], [5, 10], [5, 11], [6], [6, 9], [6, 10],
|
5394 |
+
[6, 11], [7], [7, 10], [7, 11], [8], [8, 11], [9], [10], [11]]
|
5395 |
+
|
5396 |
+
###################################################################################
|
5397 |
+
|
5398 |
+
def harmonize_enhanced_melody_score_notes(enhanced_melody_score_notes):
|
5399 |
+
|
5400 |
+
mel_tones = [e[4] % 12 for e in enhanced_melody_score_notes]
|
5401 |
+
|
5402 |
+
cur_chord = []
|
5403 |
+
|
5404 |
+
song = []
|
5405 |
+
|
5406 |
+
for i, m in enumerate(mel_tones):
|
5407 |
+
cur_chord.append(m)
|
5408 |
+
cc = sorted(set(cur_chord))
|
5409 |
+
|
5410 |
+
if cc in ALL_CHORDS_FILTERED:
|
5411 |
+
song.append(cc)
|
5412 |
+
|
5413 |
+
else:
|
5414 |
+
while sorted(set(cur_chord)) not in ALL_CHORDS_FILTERED:
|
5415 |
+
cur_chord.pop(0)
|
5416 |
+
cc = sorted(set(cur_chord))
|
5417 |
+
song.append(cc)
|
5418 |
+
|
5419 |
+
return song
|
5420 |
+
|
5421 |
+
###################################################################################
|
5422 |
+
|
5423 |
+
def split_melody(enhanced_melody_score_notes,
|
5424 |
+
split_time=-1,
|
5425 |
+
max_score_time=255
|
5426 |
+
):
|
5427 |
+
|
5428 |
+
mel_chunks = []
|
5429 |
+
|
5430 |
+
if split_time == -1:
|
5431 |
+
|
5432 |
+
durs = [max(0, min(max_score_time, e[2])) for e in enhanced_melody_score_notes]
|
5433 |
+
stime = max(durs)
|
5434 |
+
|
5435 |
+
else:
|
5436 |
+
stime = split_time
|
5437 |
+
|
5438 |
+
pe = enhanced_melody_score_notes[0]
|
5439 |
+
chu = []
|
5440 |
+
|
5441 |
+
for e in enhanced_melody_score_notes:
|
5442 |
+
dtime = max(0, min(max_score_time, e[1]-pe[1]))
|
5443 |
+
|
5444 |
+
if dtime > max(durs):
|
5445 |
+
if chu:
|
5446 |
+
mel_chunks.append(chu)
|
5447 |
+
chu = []
|
5448 |
+
chu.append(e)
|
5449 |
+
else:
|
5450 |
+
chu.append(e)
|
5451 |
+
|
5452 |
+
pe = e
|
5453 |
+
|
5454 |
+
if chu:
|
5455 |
+
mel_chunks.append(chu)
|
5456 |
+
|
5457 |
+
return mel_chunks, [[m[0][1], m[-1][1]] for m in mel_chunks], len(mel_chunks)
|
5458 |
+
|
5459 |
+
###################################################################################
|
5460 |
+
|
5461 |
+
def flatten(list_of_lists):
|
5462 |
+
return [x for y in list_of_lists for x in y]
|
5463 |
+
|
5464 |
+
###################################################################################
|
5465 |
+
|
5466 |
+
def enhanced_delta_score_notes(enhanced_score_notes,
|
5467 |
+
start_time=0,
|
5468 |
+
max_score_time=255
|
5469 |
+
):
|
5470 |
+
|
5471 |
+
delta_score = []
|
5472 |
+
|
5473 |
+
pe = ['note', max(0, enhanced_score_notes[0][1]-start_time)]
|
5474 |
+
|
5475 |
+
for e in enhanced_score_notes:
|
5476 |
+
|
5477 |
+
dtime = max(0, min(max_score_time, e[1]-pe[1]))
|
5478 |
+
dur = max(1, min(max_score_time, e[2]))
|
5479 |
+
cha = max(0, min(15, e[3]))
|
5480 |
+
ptc = max(1, min(127, e[4]))
|
5481 |
+
vel = max(1, min(127, e[5]))
|
5482 |
+
pat = max(0, min(128, e[6]))
|
5483 |
+
|
5484 |
+
delta_score.append([dtime, dur, cha, ptc, vel, pat])
|
5485 |
+
|
5486 |
+
pe = e
|
5487 |
+
|
5488 |
+
return delta_score
|
5489 |
+
|
5490 |
+
###################################################################################
|
5491 |
+
|
5492 |
+
def basic_enhanced_delta_score_notes_tokenizer(enhanced_delta_score_notes,
|
5493 |
+
tokenize_start_times=True,
|
5494 |
+
tokenize_durations=True,
|
5495 |
+
tokenize_channels=True,
|
5496 |
+
tokenize_pitches=True,
|
5497 |
+
tokenize_velocities=True,
|
5498 |
+
tokenize_patches=True,
|
5499 |
+
score_timings_range=256,
|
5500 |
+
max_seq_len=-1,
|
5501 |
+
seq_pad_value=-1
|
5502 |
+
):
|
5503 |
+
|
5504 |
+
|
5505 |
+
|
5506 |
+
score_tokens_ints_seq = []
|
5507 |
+
|
5508 |
+
tokens_shifts = [-1] * 7
|
5509 |
+
|
5510 |
+
for d in enhanced_delta_score_notes:
|
5511 |
+
|
5512 |
+
seq = []
|
5513 |
+
shift = 0
|
5514 |
+
|
5515 |
+
if tokenize_start_times:
|
5516 |
+
seq.append(d[0])
|
5517 |
+
tokens_shifts[0] = shift
|
5518 |
+
shift += score_timings_range
|
5519 |
+
|
5520 |
+
if tokenize_durations:
|
5521 |
+
seq.append(d[1]+shift)
|
5522 |
+
tokens_shifts[1] = shift
|
5523 |
+
shift += score_timings_range
|
5524 |
+
|
5525 |
+
if tokenize_channels:
|
5526 |
+
tokens_shifts[2] = shift
|
5527 |
+
seq.append(d[2]+shift)
|
5528 |
+
shift += 16
|
5529 |
+
|
5530 |
+
if tokenize_pitches:
|
5531 |
+
tokens_shifts[3] = shift
|
5532 |
+
seq.append(d[3]+shift)
|
5533 |
+
shift += 128
|
5534 |
+
|
5535 |
+
if tokenize_velocities:
|
5536 |
+
tokens_shifts[4] = shift
|
5537 |
+
seq.append(d[4]+shift)
|
5538 |
+
shift += 128
|
5539 |
+
|
5540 |
+
if tokenize_patches:
|
5541 |
+
tokens_shifts[5] = shift
|
5542 |
+
seq.append(d[5]+shift)
|
5543 |
+
shift += 129
|
5544 |
+
|
5545 |
+
tokens_shifts[6] = shift
|
5546 |
+
score_tokens_ints_seq.append(seq)
|
5547 |
+
|
5548 |
+
final_score_tokens_ints_seq = flatten(score_tokens_ints_seq)
|
5549 |
+
|
5550 |
+
if max_seq_len > -1:
|
5551 |
+
final_score_tokens_ints_seq = flat_score_tokens_ints_seq[:max_seq_len]
|
5552 |
+
|
5553 |
+
if seq_pad_value > -1:
|
5554 |
+
final_score_tokens_ints_seq += [seq_pad_value] * (max_seq_len - len(final_score_tokens_ints_seq))
|
5555 |
+
|
5556 |
+
return [score_tokens_ints_seq,
|
5557 |
+
final_score_tokens_ints_seq,
|
5558 |
+
tokens_shifts,
|
5559 |
+
seq_pad_value,
|
5560 |
+
max_seq_len,
|
5561 |
+
len(score_tokens_ints_seq),
|
5562 |
+
len(final_score_tokens_ints_seq)
|
5563 |
+
]
|
5564 |
+
|
5565 |
+
###################################################################################
|
5566 |
+
|
5567 |
+
def basic_enhanced_delta_score_notes_detokenizer(tokenized_seq,
|
5568 |
+
tokens_shifts,
|
5569 |
+
timings_multiplier=16
|
5570 |
+
):
|
5571 |
+
|
5572 |
+
song_f = []
|
5573 |
+
|
5574 |
+
time = 0
|
5575 |
+
dur = 16
|
5576 |
+
channel = 0
|
5577 |
+
pitch = 60
|
5578 |
+
vel = 90
|
5579 |
+
pat = 0
|
5580 |
+
|
5581 |
+
note_seq_len = len([t for t in tokens_shifts if t > -1])-1
|
5582 |
+
tok_shifts_idxs = [i for i in range(len(tokens_shifts[:-1])) if tokens_shifts[i] > - 1]
|
5583 |
+
|
5584 |
+
song = []
|
5585 |
+
|
5586 |
+
for i in range(0, len(tokenized_seq), note_seq_len):
|
5587 |
+
note = tokenized_seq[i:i+note_seq_len]
|
5588 |
+
song.append(note)
|
5589 |
+
|
5590 |
+
for note in song:
|
5591 |
+
for i, idx in enumerate(tok_shifts_idxs):
|
5592 |
+
if idx == 0:
|
5593 |
+
time += (note[i]-tokens_shifts[0]) * timings_multiplier
|
5594 |
+
elif idx == 1:
|
5595 |
+
dur = (note[i]-tokens_shifts[1]) * timings_multiplier
|
5596 |
+
elif idx == 2:
|
5597 |
+
channel = (note[i]-tokens_shifts[2])
|
5598 |
+
elif idx == 3:
|
5599 |
+
pitch = (note[i]-tokens_shifts[3])
|
5600 |
+
elif idx == 4:
|
5601 |
+
vel = (note[i]-tokens_shifts[4])
|
5602 |
+
elif idx == 5:
|
5603 |
+
pat = (note[i]-tokens_shifts[5])
|
5604 |
+
|
5605 |
+
song_f.append(['note', time, dur, channel, pitch, vel, pat ])
|
5606 |
+
|
5607 |
+
return song_f
|
5608 |
+
|
5609 |
+
###################################################################################
|
5610 |
+
|
5611 |
+
def enhanced_chord_to_chord_token(enhanced_chord,
|
5612 |
+
channels_index=3,
|
5613 |
+
pitches_index=4,
|
5614 |
+
use_filtered_chords=True
|
5615 |
+
):
|
5616 |
+
|
5617 |
+
bad_chords_counter = 0
|
5618 |
+
duplicate_pitches_counter = 0
|
5619 |
+
|
5620 |
+
if use_filtered_chords:
|
5621 |
+
CHORDS = ALL_CHORDS_FILTERED
|
5622 |
+
else:
|
5623 |
+
CHORDS = ALL_CHORDS_SORTED
|
5624 |
+
|
5625 |
+
tones_chord = sorted(set([t[pitches_index] % 12 for t in enhanced_chord if t[channels_index] != 9]))
|
5626 |
+
|
5627 |
+
original_tones_chord = copy.deepcopy(tones_chord)
|
5628 |
+
|
5629 |
+
if tones_chord:
|
5630 |
+
|
5631 |
+
if tones_chord not in CHORDS:
|
5632 |
+
|
5633 |
+
pitches_chord = sorted(set([p[pitches_index] for p in enhanced_chord if p[channels_index] != 9]), reverse=True)
|
5634 |
+
|
5635 |
+
if len(tones_chord) == 2:
|
5636 |
+
tones_counts = Counter([p % 12 for p in pitches_chord]).most_common()
|
5637 |
+
|
5638 |
+
if tones_counts[0][1] > 1:
|
5639 |
+
tones_chord = [tones_counts[0][0]]
|
5640 |
+
elif tones_counts[1][1] > 1:
|
5641 |
+
tones_chord = [tones_counts[1][0]]
|
5642 |
+
else:
|
5643 |
+
tones_chord = [pitches_chord[0] % 12]
|
5644 |
+
|
5645 |
+
else:
|
5646 |
+
tones_chord_combs = [list(comb) for i in range(len(tones_chord)-2, 0, -1) for comb in combinations(tones_chord, i+1)]
|
5647 |
+
|
5648 |
+
for co in tones_chord_combs:
|
5649 |
+
if co in CHORDS:
|
5650 |
+
tones_chord = co
|
5651 |
+
break
|
5652 |
+
|
5653 |
+
if use_filtered_chords:
|
5654 |
+
chord_token = ALL_CHORDS_FILTERED.index(tones_chord)
|
5655 |
+
else:
|
5656 |
+
chord_token = ALL_CHORDS_SORTED.index(tones_chord)
|
5657 |
+
|
5658 |
+
return [chord_token, tones_chord, original_tones_chord, sorted(set(original_tones_chord) ^ set(tones_chord))]
|
5659 |
+
|
5660 |
+
###################################################################################
|
5661 |
+
|
5662 |
+
def enhanced_chord_to_tones_chord(enhanced_chord):
|
5663 |
+
return sorted(set([t[4] % 12 for t in enhanced_chord if t[3] != 9]))
|
5664 |
+
|
5665 |
+
###################################################################################
|
5666 |
+
|
5667 |
+
import hashlib
|
5668 |
+
|
5669 |
+
###################################################################################
|
5670 |
+
|
5671 |
+
def md5_hash(file_path_or_data=None, original_md5_hash=None):
|
5672 |
+
|
5673 |
+
if type(file_path_or_data) == str:
|
5674 |
+
|
5675 |
+
with open(file_path_or_data, 'rb') as file_to_check:
|
5676 |
+
data = file_to_check.read()
|
5677 |
+
|
5678 |
+
if data:
|
5679 |
+
md5 = hashlib.md5(data).hexdigest()
|
5680 |
+
|
5681 |
+
else:
|
5682 |
+
if file_path_or_data:
|
5683 |
+
md5 = hashlib.md5(file_path_or_data).hexdigest()
|
5684 |
+
|
5685 |
+
if md5:
|
5686 |
+
|
5687 |
+
if original_md5_hash:
|
5688 |
+
|
5689 |
+
if md5 == original_md5_hash:
|
5690 |
+
check = True
|
5691 |
+
else:
|
5692 |
+
check = False
|
5693 |
+
|
5694 |
+
else:
|
5695 |
+
check = None
|
5696 |
+
|
5697 |
+
return [md5, check]
|
5698 |
+
|
5699 |
+
else:
|
5700 |
+
|
5701 |
+
md5 = None
|
5702 |
+
check = None
|
5703 |
+
|
5704 |
+
return [md5, check]
|
5705 |
+
|
5706 |
+
###################################################################################
|
5707 |
+
|
5708 |
+
ALL_PITCHES_CHORDS_FILTERED = [[67], [64], [62], [69], [60], [65], [59], [70], [66], [63], [68], [61],
|
5709 |
+
[64, 60], [67, 64], [65, 62], [62, 59], [69, 65], [60, 57], [66, 62], [59, 55],
|
5710 |
+
[62, 57], [67, 62], [64, 59], [64, 60, 55], [60, 55], [65, 60], [64, 61],
|
5711 |
+
[69, 64], [66, 62, 57], [69, 66], [62, 59, 55], [64, 60, 57], [62, 58],
|
5712 |
+
[65, 60, 57], [70, 67], [67, 63], [64, 61, 57], [61, 57], [63, 60], [68, 64],
|
5713 |
+
[65, 62, 58], [65, 62, 57], [59, 56], [63, 58], [68, 65], [59, 54, 47, 35],
|
5714 |
+
[70, 65], [66, 61], [64, 59, 56], [65, 61], [64, 59, 55], [63, 59], [61, 58],
|
5715 |
+
[68, 63], [60, 56], [67, 63, 60], [67, 63, 58], [66, 62, 59], [61, 56],
|
5716 |
+
[70, 66], [67, 62, 58], [63, 60, 56], [65, 61, 56], [66, 61, 58], [66, 61, 57],
|
5717 |
+
[65, 60, 56], [65, 61, 58], [65, 59], [68, 64, 61], [66, 60], [64, 58],
|
5718 |
+
[62, 56], [63, 57], [61, 55], [66, 64], [60, 58], [65, 63], [63, 59, 56],
|
5719 |
+
[65, 62, 59], [61, 59], [66, 60, 57], [64, 61, 55], [64, 58, 55], [62, 59, 56],
|
5720 |
+
[64, 60, 58], [63, 60, 57], [64, 60, 58, 55], [65, 62, 56], [64, 61, 58],
|
5721 |
+
[66, 64, 59], [60, 58, 55], [65, 63, 60], [63, 57, 53], [65, 63, 60, 57],
|
5722 |
+
[65, 59, 56], [63, 60, 58, 55], [67, 61, 58], [64, 61, 57, 54], [64, 61, 59],
|
5723 |
+
[70, 65, 60], [68, 65, 63, 60], [63, 60, 58], [65, 63, 58], [69, 66, 64],
|
5724 |
+
[64, 60, 54], [64, 60, 57, 54], [66, 64, 61], [66, 61, 59], [67, 63, 59],
|
5725 |
+
[65, 61, 57], [68, 65, 63], [64, 61, 59, 56], [65, 61, 59], [66, 64, 61, 58],
|
5726 |
+
[64, 61, 58, 55], [64, 60, 56], [65, 61, 59, 56], [66, 62, 58], [61, 59, 56],
|
5727 |
+
[64, 58, 54], [63, 59, 53], [65, 62, 59, 56], [61, 59, 55], [64, 61, 59, 55],
|
5728 |
+
[68, 65, 63, 59], [70, 66, 60], [65, 63, 60, 58], [64, 61, 59, 54],
|
5729 |
+
[70, 64, 60, 54]]
|
5730 |
+
|
5731 |
+
###################################################################################
|
5732 |
+
|
5733 |
+
ALL_PITCHES_CHORDS_SORTED = [[60], [62, 60], [63, 60], [64, 60], [64, 62, 60], [65, 60], [65, 62, 60],
|
5734 |
+
[65, 63, 60], [66, 60], [66, 62, 60], [66, 63, 60], [64, 60, 54],
|
5735 |
+
[64, 60, 54, 50], [60, 55], [67, 62, 60], [67, 63, 60], [64, 60, 55],
|
5736 |
+
[65, 60, 55], [64, 62, 60, 55], [67, 65, 62, 60], [67, 65, 63, 60], [60, 56],
|
5737 |
+
[62, 60, 56], [63, 60, 56], [64, 60, 56], [65, 60, 56], [66, 60, 56],
|
5738 |
+
[72, 68, 64, 62], [65, 62, 60, 56], [66, 62, 60, 56], [68, 65, 63, 60],
|
5739 |
+
[68, 66, 63, 60], [60, 44, 42, 40], [88, 80, 74, 66, 60, 56], [60, 57],
|
5740 |
+
[62, 60, 57], [63, 60, 57], [64, 60, 57], [65, 60, 57], [66, 60, 57],
|
5741 |
+
[67, 60, 57], [64, 62, 60, 57], [65, 62, 60, 57], [69, 66, 62, 60],
|
5742 |
+
[67, 62, 60, 57], [65, 63, 60, 57], [66, 63, 60, 57], [67, 63, 60, 57],
|
5743 |
+
[64, 60, 57, 54], [67, 64, 60, 57], [67, 65, 60, 57], [69, 64, 60, 54, 38],
|
5744 |
+
[67, 64, 62, 60, 57], [67, 65, 62, 60, 57], [67, 65, 63, 60, 57], [60, 58],
|
5745 |
+
[62, 60, 58], [63, 60, 58], [64, 60, 58], [70, 65, 60], [70, 66, 60],
|
5746 |
+
[60, 58, 55], [70, 60, 56], [74, 64, 60, 58], [65, 62, 60, 58],
|
5747 |
+
[70, 66, 62, 60], [62, 60, 58, 55], [72, 68, 62, 58], [65, 63, 60, 58],
|
5748 |
+
[70, 66, 63, 60], [63, 60, 58, 55], [70, 63, 60, 56], [70, 64, 60, 54],
|
5749 |
+
[64, 60, 58, 55], [68, 64, 60, 58], [65, 60, 58, 55], [70, 65, 60, 56],
|
5750 |
+
[70, 66, 60, 56], [78, 76, 74, 72, 70, 66], [67, 64, 62, 58, 36],
|
5751 |
+
[74, 68, 64, 58, 48], [65, 62, 58, 55, 36], [65, 62, 60, 56, 46],
|
5752 |
+
[72, 66, 62, 56, 46], [79, 65, 63, 58, 53, 36], [65, 60, 56, 51, 46, 41],
|
5753 |
+
[70, 66, 63, 60, 44], [68, 66, 64, 58, 56, 48],
|
5754 |
+
[94, 92, 90, 88, 86, 84, 82, 80, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58,
|
5755 |
+
56, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24],
|
5756 |
+
[61], [63, 61], [64, 61], [65, 61], [65, 63, 61], [66, 61], [66, 63, 61],
|
5757 |
+
[66, 64, 61], [61, 55], [67, 63, 61], [64, 61, 55], [65, 61, 55],
|
5758 |
+
[65, 61, 55, 39], [61, 56], [63, 61, 56], [68, 64, 61], [65, 61, 56],
|
5759 |
+
[66, 61, 56], [68, 65, 63, 61], [54, 49, 44, 39], [68, 64, 61, 42], [61, 57],
|
5760 |
+
[63, 61, 57], [64, 61, 57], [65, 61, 57], [66, 61, 57], [67, 61, 57],
|
5761 |
+
[69, 65, 63, 61], [66, 63, 61, 57], [67, 63, 61, 57], [64, 61, 57, 54],
|
5762 |
+
[67, 64, 61, 57], [65, 61, 55, 45], [67, 65, 63, 61, 57], [61, 58],
|
5763 |
+
[63, 61, 58], [64, 61, 58], [65, 61, 58], [66, 61, 58], [67, 61, 58],
|
5764 |
+
[61, 58, 56], [65, 63, 61, 58], [66, 63, 61, 58], [67, 63, 61, 58],
|
5765 |
+
[63, 61, 58, 56], [66, 64, 61, 58], [64, 61, 58, 55], [68, 64, 61, 58],
|
5766 |
+
[65, 61, 58, 55], [65, 61, 58, 56], [58, 54, 49, 44], [70, 65, 61, 55, 39],
|
5767 |
+
[80, 68, 65, 63, 61, 58], [63, 58, 54, 49, 44, 39], [73, 68, 64, 58, 54],
|
5768 |
+
[61, 59], [63, 61, 59], [64, 61, 59], [65, 61, 59], [66, 61, 59], [61, 59, 55],
|
5769 |
+
[61, 59, 56], [61, 59, 57], [63, 59, 53, 49], [66, 63, 61, 59],
|
5770 |
+
[71, 67, 63, 61], [63, 61, 59, 56], [61, 57, 51, 47], [64, 61, 59, 54],
|
5771 |
+
[64, 61, 59, 55], [64, 61, 59, 56], [64, 61, 59, 57], [65, 61, 59, 55],
|
5772 |
+
[65, 61, 59, 56], [69, 65, 61, 59], [66, 61, 59, 56], [71, 66, 61, 57],
|
5773 |
+
[71, 67, 61, 57], [67, 63, 59, 53, 49], [68, 65, 63, 59, 37],
|
5774 |
+
[65, 63, 61, 59, 57], [66, 63, 61, 59, 56], [73, 69, 66, 63, 59],
|
5775 |
+
[79, 75, 73, 61, 59, 33], [61, 56, 52, 47, 42, 35], [76, 73, 69, 66, 35],
|
5776 |
+
[71, 67, 64, 61, 57], [73, 71, 69, 67, 65],
|
5777 |
+
[95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59,
|
5778 |
+
57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25],
|
5779 |
+
[62], [64, 62], [65, 62], [66, 62], [66, 64, 62], [67, 62], [67, 64, 62],
|
5780 |
+
[67, 65, 62], [62, 56], [68, 64, 62], [65, 62, 56], [66, 62, 56],
|
5781 |
+
[66, 62, 56, 52], [62, 57], [50, 45, 40], [65, 62, 57], [66, 62, 57],
|
5782 |
+
[55, 50, 45], [66, 64, 62, 57], [55, 50, 45, 40], [69, 67, 65, 62], [62, 58],
|
5783 |
+
[64, 62, 58], [65, 62, 58], [66, 62, 58], [67, 62, 58], [62, 58, 56],
|
5784 |
+
[66, 64, 62, 58], [67, 64, 62, 58], [64, 62, 58, 56], [65, 62, 58, 55],
|
5785 |
+
[65, 62, 58, 56], [66, 62, 58, 56], [66, 64, 58, 44, 38], [62, 59],
|
5786 |
+
[64, 62, 59], [65, 62, 59], [66, 62, 59], [62, 59, 55], [62, 59, 56],
|
5787 |
+
[62, 59, 57], [66, 64, 62, 59], [67, 64, 62, 59], [64, 62, 59, 56],
|
5788 |
+
[64, 62, 59, 57], [67, 65, 62, 59], [65, 62, 59, 56], [69, 65, 62, 59],
|
5789 |
+
[66, 62, 59, 56], [69, 66, 62, 59], [59, 55, 50, 45], [64, 62, 59, 56, 54],
|
5790 |
+
[69, 66, 62, 59, 40], [64, 59, 55, 50, 45, 40], [69, 65, 62, 59, 55], [63],
|
5791 |
+
[65, 63], [66, 63], [67, 63], [67, 65, 63], [68, 63], [68, 65, 63],
|
5792 |
+
[68, 66, 63], [63, 57], [63, 57, 53], [66, 63, 57], [67, 63, 57],
|
5793 |
+
[67, 63, 57, 53], [63, 58], [65, 63, 58], [66, 63, 58], [67, 63, 58],
|
5794 |
+
[68, 63, 58], [67, 65, 63, 58], [63, 58, 56, 53], [70, 68, 66, 63], [63, 59],
|
5795 |
+
[63, 59, 53], [66, 63, 59], [67, 63, 59], [63, 59, 56], [63, 59, 57],
|
5796 |
+
[63, 59, 55, 53], [68, 65, 63, 59], [69, 65, 63, 59], [66, 63, 59, 56],
|
5797 |
+
[66, 63, 59, 57], [67, 63, 59, 57], [67, 63, 59, 57, 41], [64], [66, 64],
|
5798 |
+
[67, 64], [68, 64], [68, 66, 64], [69, 64], [69, 66, 64], [69, 67, 64],
|
5799 |
+
[64, 58], [64, 58, 54], [64, 58, 55], [68, 64, 58], [68, 64, 58, 42], [64, 59],
|
5800 |
+
[66, 64, 59], [64, 59, 55], [64, 59, 56], [64, 59, 57], [64, 59, 56, 54],
|
5801 |
+
[64, 59, 57, 54], [69, 64, 59, 55], [65], [67, 65], [68, 65], [69, 65],
|
5802 |
+
[69, 67, 65], [70, 65], [65, 58, 55], [70, 68, 65], [65, 59], [65, 59, 55],
|
5803 |
+
[65, 59, 56], [59, 57, 53], [69, 65, 59, 55], [66], [68, 66], [69, 66],
|
5804 |
+
[70, 66], [80, 70, 54], [59, 54, 47, 35], [66, 59, 56], [71, 69, 66], [67],
|
5805 |
+
[69, 67], [70, 67], [59, 55], [71, 69, 67], [68], [70, 68], [59, 56], [69],
|
5806 |
+
[71, 69], [70], [59]]
|
5807 |
+
|
5808 |
+
###################################################################################
|
5809 |
+
|
5810 |
+
def sort_list_by_other(list1, list2):
|
5811 |
+
return sorted(list1, key=lambda x: list2.index(x) if x in list2 else len(list2))
|
5812 |
+
|
5813 |
+
###################################################################################
|
5814 |
+
|
5815 |
+
ALL_CHORDS_PAIRS_SORTED = [[[0], [0, 4, 7]], [[0, 2], [0, 4, 7]], [[0, 3], [0, 3, 7]],
|
5816 |
+
[[0, 4], [0, 4, 7]], [[0, 2, 4], [0, 2, 4, 7]], [[0, 5], [0, 5, 9]],
|
5817 |
+
[[0, 2, 5], [0, 2, 5, 9]], [[0, 3, 5], [0, 3, 5, 9]], [[0, 6], [0, 2, 6, 9]],
|
5818 |
+
[[0, 2, 6], [0, 2, 6, 9]], [[0, 3, 6], [0, 3, 6, 8]],
|
5819 |
+
[[0, 4, 6], [0, 4, 6, 9]], [[0, 2, 4, 6], [0, 2, 4, 6, 9]],
|
5820 |
+
[[0, 7], [0, 4, 7]], [[0, 2, 7], [0, 2, 4, 7]], [[0, 3, 7], [0, 3, 7, 10]],
|
5821 |
+
[[0, 4, 7], [0, 4, 7, 9]], [[0, 5, 7], [0, 5, 7, 9]],
|
5822 |
+
[[0, 2, 4, 7], [0, 2, 4, 7, 9]], [[0, 2, 5, 7], [0, 2, 5, 7, 9]],
|
5823 |
+
[[0, 3, 5, 7], [0, 3, 5, 7, 10]], [[0, 8], [0, 3, 8]],
|
5824 |
+
[[0, 2, 8], [0, 2, 5, 8]], [[0, 3, 8], [0, 3, 5, 8]],
|
5825 |
+
[[0, 4, 8], [2, 4, 8, 11]], [[0, 5, 8], [0, 3, 5, 8]],
|
5826 |
+
[[0, 6, 8], [0, 3, 6, 8]], [[0, 2, 4, 8], [0, 2, 4, 6, 8]],
|
5827 |
+
[[0, 2, 5, 8], [0, 2, 5, 8, 10]], [[0, 2, 6, 8], [0, 2, 6, 8, 10]],
|
5828 |
+
[[0, 3, 5, 8], [0, 3, 5, 8, 10]], [[0, 3, 6, 8], [0, 3, 6, 8, 10]],
|
5829 |
+
[[0, 4, 6, 8], [2, 4, 6, 8, 11]], [[0, 2, 4, 6, 8], [2, 4, 6, 8, 11]],
|
5830 |
+
[[0, 9], [0, 4, 9]], [[0, 2, 9], [0, 2, 6, 9]], [[0, 3, 9], [0, 3, 5, 9]],
|
5831 |
+
[[0, 4, 9], [0, 4, 7, 9]], [[0, 5, 9], [0, 2, 5, 9]],
|
5832 |
+
[[0, 6, 9], [0, 2, 6, 9]], [[0, 7, 9], [0, 4, 7, 9]],
|
5833 |
+
[[0, 2, 4, 9], [0, 2, 4, 7, 9]], [[0, 2, 5, 9], [0, 2, 5, 7, 9]],
|
5834 |
+
[[0, 2, 6, 9], [0, 2, 4, 6, 9]], [[0, 2, 7, 9], [0, 2, 4, 7, 9]],
|
5835 |
+
[[0, 3, 5, 9], [0, 3, 5, 7, 9]], [[0, 3, 6, 9], [0, 2, 4, 6, 9]],
|
5836 |
+
[[0, 3, 7, 9], [0, 3, 5, 7, 9]], [[0, 4, 6, 9], [0, 2, 4, 6, 9]],
|
5837 |
+
[[0, 4, 7, 9], [0, 2, 4, 7, 9]], [[0, 5, 7, 9], [0, 2, 5, 7, 9]],
|
5838 |
+
[[0, 2, 4, 6, 9], [2, 4, 6, 9, 11]], [[0, 2, 4, 7, 9], [2, 4, 7, 9, 11]],
|
5839 |
+
[[0, 2, 5, 7, 9], [2, 5, 7, 9, 11]], [[0, 3, 5, 7, 9], [2, 4, 6, 8, 11]],
|
5840 |
+
[[0, 10], [2, 5, 10]], [[0, 2, 10], [0, 2, 5, 10]],
|
5841 |
+
[[0, 3, 10], [0, 3, 7, 10]], [[0, 4, 10], [0, 4, 7, 10]],
|
5842 |
+
[[0, 5, 10], [0, 2, 5, 10]], [[0, 6, 10], [0, 3, 6, 10]],
|
5843 |
+
[[0, 7, 10], [0, 4, 7, 10]], [[0, 8, 10], [0, 3, 8, 10]],
|
5844 |
+
[[0, 2, 4, 10], [0, 2, 4, 7, 10]], [[0, 2, 5, 10], [0, 2, 5, 7, 10]],
|
5845 |
+
[[0, 2, 6, 10], [0, 2, 6, 8, 10]], [[0, 2, 7, 10], [0, 2, 5, 7, 10]],
|
5846 |
+
[[0, 2, 8, 10], [0, 2, 5, 8, 10]], [[0, 3, 5, 10], [0, 3, 5, 7, 10]],
|
5847 |
+
[[0, 3, 6, 10], [0, 3, 6, 8, 10]], [[0, 3, 7, 10], [0, 3, 5, 7, 10]],
|
5848 |
+
[[0, 3, 8, 10], [0, 3, 5, 8, 10]], [[0, 4, 6, 10], [0, 2, 4, 6, 10]],
|
5849 |
+
[[0, 4, 7, 10], [0, 2, 4, 7, 10]], [[0, 4, 8, 10], [0, 2, 4, 8, 10]],
|
5850 |
+
[[0, 5, 7, 10], [0, 3, 5, 7, 10]], [[0, 5, 8, 10], [0, 3, 5, 8, 10]],
|
5851 |
+
[[0, 6, 8, 10], [0, 3, 6, 8, 10]], [[0, 2, 4, 6, 10], [0, 2, 4, 8, 10]],
|
5852 |
+
[[0, 2, 4, 7, 10], [1, 3, 6, 9, 11]], [[0, 2, 4, 8, 10], [1, 3, 7, 9, 11]],
|
5853 |
+
[[0, 2, 5, 7, 10], [0, 3, 5, 7, 10]], [[0, 2, 5, 8, 10], [1, 4, 7, 9, 11]],
|
5854 |
+
[[0, 2, 6, 8, 10], [2, 4, 6, 8, 10]], [[0, 3, 5, 7, 10], [0, 2, 5, 7, 10]],
|
5855 |
+
[[0, 3, 5, 8, 10], [1, 3, 5, 8, 10]], [[0, 3, 6, 8, 10], [1, 3, 6, 8, 10]],
|
5856 |
+
[[0, 4, 6, 8, 10], [0, 2, 4, 6, 9]],
|
5857 |
+
[[0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11]], [[1], [1, 8]], [[1, 3], [1, 5, 8]],
|
5858 |
+
[[1, 4], [1, 4, 9]], [[1, 5], [1, 5, 8]], [[1, 3, 5], [1, 3, 5, 10]],
|
5859 |
+
[[1, 6], [1, 6, 10]], [[1, 3, 6], [1, 3, 6, 10]], [[1, 4, 6], [1, 4, 6, 9]],
|
5860 |
+
[[1, 7], [1, 4, 7]], [[1, 3, 7], [1, 3, 7, 10]], [[1, 4, 7], [1, 4, 7, 9]],
|
5861 |
+
[[1, 5, 7], [1, 5, 7, 10]], [[1, 3, 5, 7], [1, 3, 5, 7, 10]],
|
5862 |
+
[[1, 8], [1, 5, 8]], [[1, 3, 8], [1, 3, 5, 8]], [[1, 4, 8], [1, 4, 8, 11]],
|
5863 |
+
[[1, 5, 8], [1, 5, 8, 10]], [[1, 6, 8], [1, 3, 6, 8]],
|
5864 |
+
[[1, 3, 5, 8], [1, 3, 5, 8, 10]], [[1, 3, 6, 8], [1, 3, 6, 8, 10]],
|
5865 |
+
[[1, 4, 6, 8], [1, 4, 6, 8, 11]], [[1, 9], [1, 4, 9]],
|
5866 |
+
[[1, 3, 9], [1, 3, 6, 9]], [[1, 4, 9], [1, 4, 6, 9]],
|
5867 |
+
[[1, 5, 9], [0, 3, 5, 9]], [[1, 6, 9], [1, 4, 6, 9]],
|
5868 |
+
[[1, 7, 9], [1, 4, 7, 9]], [[1, 3, 5, 9], [0, 3, 5, 7, 9]],
|
5869 |
+
[[1, 3, 6, 9], [1, 3, 6, 9, 11]], [[1, 3, 7, 9], [1, 3, 5, 7, 9]],
|
5870 |
+
[[1, 4, 6, 9], [1, 4, 6, 9, 11]], [[1, 4, 7, 9], [1, 4, 7, 9, 11]],
|
5871 |
+
[[1, 5, 7, 9], [1, 3, 7, 9, 11]], [[1, 3, 5, 7, 9], [2, 4, 6, 8, 11]],
|
5872 |
+
[[1, 10], [1, 5, 10]], [[1, 3, 10], [1, 3, 7, 10]],
|
5873 |
+
[[1, 4, 10], [1, 4, 6, 10]], [[1, 5, 10], [1, 5, 8, 10]],
|
5874 |
+
[[1, 6, 10], [1, 4, 6, 10]], [[1, 7, 10], [1, 3, 7, 10]],
|
5875 |
+
[[1, 8, 10], [1, 5, 8, 10]], [[1, 3, 5, 10], [1, 3, 5, 8, 10]],
|
5876 |
+
[[1, 3, 6, 10], [1, 3, 6, 8, 10]], [[1, 3, 7, 10], [1, 3, 5, 7, 10]],
|
5877 |
+
[[1, 3, 8, 10], [1, 3, 5, 8, 10]], [[1, 4, 6, 10], [1, 4, 6, 8, 10]],
|
5878 |
+
[[1, 4, 7, 10], [0, 2, 4, 7, 10]], [[1, 4, 8, 10], [1, 4, 6, 8, 10]],
|
5879 |
+
[[1, 5, 7, 10], [1, 3, 5, 7, 10]], [[1, 5, 8, 10], [1, 3, 5, 8, 10]],
|
5880 |
+
[[1, 6, 8, 10], [1, 3, 6, 8, 10]], [[1, 3, 5, 7, 10], [2, 4, 6, 8, 11]],
|
5881 |
+
[[1, 3, 5, 8, 10], [0, 3, 5, 8, 10]], [[1, 3, 6, 8, 10], [0, 3, 6, 8, 10]],
|
5882 |
+
[[1, 4, 6, 8, 10], [0, 3, 5, 7, 9]], [[1, 11], [2, 6, 11]],
|
5883 |
+
[[1, 3, 11], [1, 3, 6, 11]], [[1, 4, 11], [1, 4, 8, 11]],
|
5884 |
+
[[1, 5, 11], [1, 5, 8, 11]], [[1, 6, 11], [1, 4, 6, 11]],
|
5885 |
+
[[1, 7, 11], [1, 4, 7, 11]], [[1, 8, 11], [1, 4, 8, 11]],
|
5886 |
+
[[1, 9, 11], [1, 4, 9, 11]], [[1, 3, 5, 11], [1, 3, 5, 8, 11]],
|
5887 |
+
[[1, 3, 6, 11], [1, 3, 6, 8, 11]], [[1, 3, 7, 11], [1, 3, 7, 9, 11]],
|
5888 |
+
[[1, 3, 8, 11], [1, 3, 6, 8, 11]], [[1, 3, 9, 11], [1, 3, 6, 9, 11]],
|
5889 |
+
[[1, 4, 6, 11], [1, 4, 6, 9, 11]], [[1, 4, 7, 11], [1, 4, 7, 9, 11]],
|
5890 |
+
[[1, 4, 8, 11], [1, 4, 6, 8, 11]], [[1, 4, 9, 11], [1, 4, 6, 9, 11]],
|
5891 |
+
[[1, 5, 7, 11], [0, 4, 6, 8, 10]], [[1, 5, 8, 11], [1, 3, 5, 8, 11]],
|
5892 |
+
[[1, 5, 9, 11], [1, 5, 7, 9, 11]], [[1, 6, 8, 11], [1, 3, 6, 8, 11]],
|
5893 |
+
[[1, 6, 9, 11], [1, 4, 6, 9, 11]], [[1, 7, 9, 11], [1, 4, 7, 9, 11]],
|
5894 |
+
[[1, 3, 5, 7, 11], [0, 2, 4, 6, 8]], [[1, 3, 5, 8, 11], [0, 2, 4, 7, 10]],
|
5895 |
+
[[1, 3, 5, 9, 11], [1, 3, 7, 9, 11]], [[1, 3, 6, 8, 11], [1, 4, 6, 8, 11]],
|
5896 |
+
[[1, 3, 6, 9, 11], [0, 2, 5, 8, 10]], [[1, 3, 7, 9, 11], [1, 3, 6, 9, 11]],
|
5897 |
+
[[1, 4, 6, 8, 11], [1, 4, 6, 9, 11]], [[1, 4, 6, 9, 11], [2, 4, 6, 9, 11]],
|
5898 |
+
[[1, 4, 7, 9, 11], [2, 4, 7, 9, 11]], [[1, 5, 7, 9, 11], [2, 4, 7, 9, 11]],
|
5899 |
+
[[1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10]], [[2], [2, 9]], [[2, 4], [2, 6, 9]],
|
5900 |
+
[[2, 5], [2, 5, 9]], [[2, 6], [2, 6, 9]], [[2, 4, 6], [2, 4, 6, 9]],
|
5901 |
+
[[2, 7], [2, 7, 11]], [[2, 4, 7], [2, 4, 7, 11]], [[2, 5, 7], [2, 5, 7, 11]],
|
5902 |
+
[[2, 8], [4, 8, 11]], [[2, 4, 8], [2, 4, 8, 11]], [[2, 5, 8], [2, 5, 8, 10]],
|
5903 |
+
[[2, 6, 8], [2, 6, 8, 11]], [[2, 4, 6, 8], [2, 4, 6, 8, 11]],
|
5904 |
+
[[2, 9], [2, 6, 9]], [[2, 4, 9], [2, 4, 6, 9]], [[2, 5, 9], [0, 2, 5, 9]],
|
5905 |
+
[[2, 6, 9], [2, 6, 9, 11]], [[2, 7, 9], [2, 7, 9, 11]],
|
5906 |
+
[[2, 4, 6, 9], [2, 4, 6, 9, 11]], [[2, 4, 7, 9], [2, 4, 7, 9, 11]],
|
5907 |
+
[[2, 5, 7, 9], [0, 2, 5, 7, 9]], [[2, 10], [2, 5, 10]],
|
5908 |
+
[[2, 4, 10], [2, 4, 7, 10]], [[2, 5, 10], [2, 5, 7, 10]],
|
5909 |
+
[[2, 6, 10], [1, 4, 6, 10]], [[2, 7, 10], [2, 5, 7, 10]],
|
5910 |
+
[[2, 8, 10], [2, 5, 8, 10]], [[2, 4, 6, 10], [0, 2, 4, 6, 10]],
|
5911 |
+
[[2, 4, 7, 10], [0, 2, 4, 7, 10]], [[2, 4, 8, 10], [2, 4, 7, 9, 11]],
|
5912 |
+
[[2, 5, 7, 10], [0, 2, 5, 7, 10]], [[2, 5, 8, 10], [0, 2, 5, 8, 10]],
|
5913 |
+
[[2, 6, 8, 10], [1, 3, 5, 7, 10]], [[2, 4, 6, 8, 10], [0, 2, 6, 8, 10]],
|
5914 |
+
[[2, 11], [2, 7, 11]], [[2, 4, 11], [2, 4, 8, 11]],
|
5915 |
+
[[2, 5, 11], [2, 5, 7, 11]], [[2, 6, 11], [2, 6, 9, 11]],
|
5916 |
+
[[2, 7, 11], [2, 4, 7, 11]], [[2, 8, 11], [2, 4, 8, 11]],
|
5917 |
+
[[2, 9, 11], [2, 6, 9, 11]], [[2, 4, 6, 11], [2, 4, 6, 9, 11]],
|
5918 |
+
[[2, 4, 7, 11], [2, 4, 7, 9, 11]], [[2, 4, 8, 11], [2, 4, 6, 8, 11]],
|
5919 |
+
[[2, 4, 9, 11], [2, 4, 7, 9, 11]], [[2, 5, 7, 11], [2, 5, 7, 9, 11]],
|
5920 |
+
[[2, 5, 8, 11], [1, 3, 5, 8, 11]], [[2, 5, 9, 11], [2, 5, 7, 9, 11]],
|
5921 |
+
[[2, 6, 8, 11], [2, 4, 6, 8, 11]], [[2, 6, 9, 11], [2, 4, 6, 9, 11]],
|
5922 |
+
[[2, 7, 9, 11], [2, 4, 7, 9, 11]], [[2, 4, 6, 8, 11], [2, 4, 6, 9, 11]],
|
5923 |
+
[[2, 4, 6, 9, 11], [2, 4, 7, 9, 11]], [[2, 4, 7, 9, 11], [0, 2, 4, 7, 9]],
|
5924 |
+
[[2, 5, 7, 9, 11], [2, 4, 7, 9, 11]], [[3], [3, 10]], [[3, 5], [3, 7, 10]],
|
5925 |
+
[[3, 6], [3, 6, 11]], [[3, 7], [3, 7, 10]], [[3, 5, 7], [3, 5, 7, 10]],
|
5926 |
+
[[3, 8], [0, 3, 8]], [[3, 5, 8], [0, 3, 5, 8]], [[3, 6, 8], [0, 3, 6, 8]],
|
5927 |
+
[[3, 9], [0, 3, 9]], [[3, 5, 9], [0, 3, 5, 9]], [[3, 6, 9], [3, 6, 9, 11]],
|
5928 |
+
[[3, 7, 9], [0, 3, 7, 9]], [[3, 5, 7, 9], [0, 3, 5, 7, 9]],
|
5929 |
+
[[3, 10], [3, 7, 10]], [[3, 5, 10], [3, 5, 7, 10]],
|
5930 |
+
[[3, 6, 10], [1, 3, 6, 10]], [[3, 7, 10], [0, 3, 7, 10]],
|
5931 |
+
[[3, 8, 10], [0, 3, 8, 10]], [[3, 5, 7, 10], [0, 3, 5, 7, 10]],
|
5932 |
+
[[3, 5, 8, 10], [0, 3, 5, 8, 10]], [[3, 6, 8, 10], [1, 3, 6, 8, 10]],
|
5933 |
+
[[3, 11], [3, 6, 11]], [[3, 5, 11], [3, 5, 8, 11]],
|
5934 |
+
[[3, 6, 11], [3, 6, 9, 11]], [[3, 7, 11], [2, 5, 7, 11]],
|
5935 |
+
[[3, 8, 11], [3, 6, 8, 11]], [[3, 9, 11], [3, 6, 9, 11]],
|
5936 |
+
[[3, 5, 7, 11], [3, 5, 7, 9, 11]], [[3, 5, 8, 11], [1, 3, 5, 8, 11]],
|
5937 |
+
[[3, 5, 9, 11], [3, 5, 7, 9, 11]], [[3, 6, 8, 11], [1, 3, 6, 8, 11]],
|
5938 |
+
[[3, 6, 9, 11], [1, 3, 6, 9, 11]], [[3, 7, 9, 11], [2, 4, 7, 9, 11]],
|
5939 |
+
[[3, 5, 7, 9, 11], [2, 5, 7, 9, 11]], [[4], [4, 11]], [[4, 6], [4, 7, 11]],
|
5940 |
+
[[4, 7], [0, 4, 7]], [[4, 8], [4, 8, 11]], [[4, 6, 8], [4, 6, 8, 11]],
|
5941 |
+
[[4, 9], [1, 4, 9]], [[4, 6, 9], [1, 4, 6, 9]], [[4, 7, 9], [1, 4, 7, 9]],
|
5942 |
+
[[4, 10], [4, 7, 10]], [[4, 6, 10], [1, 4, 6, 10]],
|
5943 |
+
[[4, 7, 10], [0, 4, 7, 10]], [[4, 8, 10], [1, 4, 8, 10]],
|
5944 |
+
[[4, 6, 8, 10], [1, 4, 6, 8, 10]], [[4, 11], [4, 8, 11]],
|
5945 |
+
[[4, 6, 11], [4, 6, 8, 11]], [[4, 7, 11], [2, 4, 7, 11]],
|
5946 |
+
[[4, 8, 11], [2, 4, 8, 11]], [[4, 9, 11], [2, 4, 9, 11]],
|
5947 |
+
[[4, 6, 8, 11], [1, 4, 6, 8, 11]], [[4, 6, 9, 11], [2, 4, 6, 9, 11]],
|
5948 |
+
[[4, 7, 9, 11], [2, 4, 7, 9, 11]], [[5], [0, 5, 9]], [[5, 7], [0, 4, 7]],
|
5949 |
+
[[5, 8], [0, 5, 8]], [[5, 9], [0, 5, 9]], [[5, 7, 9], [0, 4, 7, 9]],
|
5950 |
+
[[5, 10], [2, 5, 10]], [[5, 7, 10], [2, 5, 7, 10]],
|
5951 |
+
[[5, 8, 10], [2, 5, 8, 10]], [[5, 11], [0, 5, 9]], [[5, 7, 11], [2, 5, 7, 11]],
|
5952 |
+
[[5, 8, 11], [1, 5, 8, 11]], [[5, 9, 11], [2, 5, 9, 11]],
|
5953 |
+
[[5, 7, 9, 11], [2, 5, 7, 9, 11]], [[6], [1, 6]], [[6, 8], [1, 5, 8]],
|
5954 |
+
[[6, 9], [2, 6, 9]], [[6, 10], [1, 6, 10]], [[6, 8, 10], [1, 5, 8, 10]],
|
5955 |
+
[[6, 11], [3, 6, 11]], [[6, 8, 11], [3, 6, 8, 11]],
|
5956 |
+
[[6, 9, 11], [3, 6, 9, 11]], [[7], [2, 7, 11]], [[7, 9], [2, 6, 9]],
|
5957 |
+
[[7, 10], [2, 7, 10]], [[7, 11], [2, 7, 11]], [[7, 9, 11], [2, 7, 9, 11]],
|
5958 |
+
[[8], [3, 8]], [[8, 10], [3, 7, 10]], [[8, 11], [4, 8, 11]], [[9], [4, 9]],
|
5959 |
+
[[9, 11], [4, 8, 11]], [[10], [2, 5, 10]], [[11], [6, 11]]]
|
5960 |
+
|
5961 |
+
###################################################################################
|
5962 |
+
|
5963 |
+
ALL_CHORDS_PAIRS_FILTERED = [[[0], [0, 4, 7]], [[0, 3], [0, 3, 7]], [[0, 3, 5], [0, 3, 5, 9]],
|
5964 |
+
[[0, 3, 5, 8], [0, 3, 7, 10]], [[0, 3, 5, 9], [0, 3, 7, 10]],
|
5965 |
+
[[0, 3, 5, 10], [0, 3, 5, 9]], [[0, 3, 7], [0, 3, 7, 10]],
|
5966 |
+
[[0, 3, 7, 10], [0, 3, 5, 9]], [[0, 3, 8], [0, 3, 5, 8]],
|
5967 |
+
[[0, 3, 9], [0, 3, 5, 9]], [[0, 3, 10], [0, 3, 7, 10]], [[0, 4], [0, 4, 7]],
|
5968 |
+
[[0, 4, 6], [0, 4, 6, 9]], [[0, 4, 6, 9], [1, 4, 6, 9]],
|
5969 |
+
[[0, 4, 6, 10], [0, 4, 7, 10]], [[0, 4, 7], [0, 4, 7, 10]],
|
5970 |
+
[[0, 4, 7, 10], [1, 4, 7, 10]], [[0, 4, 8], [0, 4, 7, 10]],
|
5971 |
+
[[0, 4, 9], [0, 4, 6, 9]], [[0, 4, 10], [0, 4, 7, 10]], [[0, 5], [0, 5, 9]],
|
5972 |
+
[[0, 5, 8], [0, 3, 5, 8]], [[0, 5, 9], [0, 3, 5, 9]],
|
5973 |
+
[[0, 5, 10], [0, 3, 5, 10]], [[0, 6], [0, 6, 9]], [[0, 6, 9], [0, 4, 6, 9]],
|
5974 |
+
[[0, 6, 10], [0, 4, 7, 10]], [[0, 7], [0, 4, 7]], [[0, 7, 10], [0, 4, 7, 10]],
|
5975 |
+
[[0, 8], [0, 3, 8]], [[0, 9], [0, 4, 9]], [[0, 10], [2, 5, 10]], [[1], [1, 8]],
|
5976 |
+
[[1, 4], [1, 4, 9]], [[1, 4, 6], [1, 4, 6, 9]], [[1, 4, 6, 9], [1, 4, 8, 11]],
|
5977 |
+
[[1, 4, 6, 10], [0, 3, 5, 9]], [[1, 4, 6, 11], [1, 4, 6, 9]],
|
5978 |
+
[[1, 4, 7], [1, 4, 7, 10]], [[1, 4, 7, 10], [0, 4, 7, 10]],
|
5979 |
+
[[1, 4, 7, 11], [1, 4, 6, 10]], [[1, 4, 8], [1, 4, 8, 11]],
|
5980 |
+
[[1, 4, 8, 11], [1, 4, 6, 9]], [[1, 4, 9], [1, 4, 6, 9]],
|
5981 |
+
[[1, 4, 10], [1, 4, 6, 10]], [[1, 4, 11], [1, 4, 8, 11]], [[1, 5], [1, 5, 8]],
|
5982 |
+
[[1, 5, 8], [1, 5, 8, 11]], [[1, 5, 8, 11], [2, 5, 8, 11]],
|
5983 |
+
[[1, 5, 9], [0, 3, 5, 9]], [[1, 5, 10], [0, 4, 7, 10]],
|
5984 |
+
[[1, 5, 11], [1, 5, 8, 11]], [[1, 6], [1, 6, 10]], [[1, 6, 9], [1, 4, 6, 9]],
|
5985 |
+
[[1, 6, 10], [1, 4, 6, 10]], [[1, 6, 11], [1, 4, 6, 11]], [[1, 7], [1, 4, 7]],
|
5986 |
+
[[1, 7, 10], [1, 4, 7, 10]], [[1, 7, 11], [1, 4, 7, 11]], [[1, 8], [1, 5, 8]],
|
5987 |
+
[[1, 8, 11], [1, 4, 8, 11]], [[1, 9], [1, 4, 9]], [[1, 10], [1, 5, 10]],
|
5988 |
+
[[1, 11], [2, 6, 11]], [[2], [2, 9]], [[2, 5], [2, 5, 9]],
|
5989 |
+
[[2, 5, 8], [2, 5, 8, 11]], [[2, 5, 8, 11], [1, 4, 7, 10]],
|
5990 |
+
[[2, 5, 9], [0, 3, 5, 9]], [[2, 5, 10], [0, 3, 5, 9]],
|
5991 |
+
[[2, 5, 11], [2, 5, 8, 11]], [[2, 6], [2, 6, 9]], [[2, 6, 9], [1, 4, 6, 9]],
|
5992 |
+
[[2, 6, 10], [1, 4, 6, 10]], [[2, 6, 11], [1, 4, 6, 10]], [[2, 7], [2, 7, 11]],
|
5993 |
+
[[2, 7, 10], [0, 4, 7, 10]], [[2, 7, 11], [1, 4, 6, 9]], [[2, 8], [4, 8, 11]],
|
5994 |
+
[[2, 8, 11], [2, 5, 8, 11]], [[2, 9], [2, 6, 9]], [[2, 10], [2, 5, 10]],
|
5995 |
+
[[2, 11], [2, 7, 11]], [[3], [3, 10]], [[3, 5], [3, 7, 10]],
|
5996 |
+
[[3, 5, 8], [0, 3, 5, 8]], [[3, 5, 8, 11], [2, 5, 8, 11]],
|
5997 |
+
[[3, 5, 9], [0, 3, 5, 9]], [[3, 5, 10], [0, 3, 5, 10]],
|
5998 |
+
[[3, 5, 11], [3, 5, 8, 11]], [[3, 7], [3, 7, 10]], [[3, 7, 10], [0, 3, 7, 10]],
|
5999 |
+
[[3, 7, 11], [0, 3, 7, 10]], [[3, 8], [0, 3, 8]], [[3, 8, 11], [3, 5, 8, 11]],
|
6000 |
+
[[3, 9], [0, 3, 9]], [[3, 10], [3, 7, 10]], [[3, 11], [3, 8, 11]],
|
6001 |
+
[[4], [4, 11]], [[4, 6], [4, 7, 11]], [[4, 6, 9], [1, 4, 6, 9]],
|
6002 |
+
[[4, 6, 10], [1, 4, 6, 10]], [[4, 6, 11], [1, 4, 6, 11]], [[4, 7], [0, 4, 7]],
|
6003 |
+
[[4, 7, 10], [0, 4, 7, 10]], [[4, 7, 11], [1, 4, 7, 11]], [[4, 8], [4, 8, 11]],
|
6004 |
+
[[4, 8, 11], [1, 4, 8, 11]], [[4, 9], [1, 4, 9]], [[4, 10], [4, 7, 10]],
|
6005 |
+
[[4, 11], [4, 8, 11]], [[5], [0, 5, 9]], [[5, 8], [0, 5, 8]],
|
6006 |
+
[[5, 8, 11], [1, 5, 8, 11]], [[5, 9], [0, 5, 9]], [[5, 10], [2, 5, 10]],
|
6007 |
+
[[5, 11], [0, 5, 9]], [[6], [1, 6]], [[6, 9], [2, 6, 9]],
|
6008 |
+
[[6, 10], [1, 6, 10]], [[6, 11], [2, 6, 11]], [[7], [2, 7, 11]],
|
6009 |
+
[[7, 10], [2, 7, 10]], [[7, 11], [2, 7, 11]], [[8], [3, 8]],
|
6010 |
+
[[8, 11], [4, 8, 11]], [[9], [4, 9]], [[10], [2, 5, 10]], [[11], [6, 11]]]
|
6011 |
+
|
6012 |
+
###################################################################################
|
6013 |
+
|
6014 |
+
ALL_CHORDS_TRIPLETS_SORTED = [[[0], [0, 4, 7], [0]], [[0, 2], [0, 4, 7], [0]], [[0, 3], [0, 3, 7], [0]],
|
6015 |
+
[[0, 4], [0, 4, 7], [0, 4]], [[0, 2, 4], [0, 2, 4, 7], [0]],
|
6016 |
+
[[0, 5], [0, 5, 9], [0, 5]], [[0, 2, 5], [0, 2, 5, 9], [0, 2, 5]],
|
6017 |
+
[[0, 3, 5], [0, 3, 5, 9], [0, 3, 5]], [[0, 6], [0, 2, 6, 9], [2]],
|
6018 |
+
[[0, 2, 6], [0, 2, 6, 9], [0, 2, 6]], [[0, 3, 6], [0, 3, 6, 8], [0, 3, 6]],
|
6019 |
+
[[0, 4, 6], [0, 4, 6, 9], [0, 4, 6]],
|
6020 |
+
[[0, 2, 4, 6], [0, 2, 4, 6, 9], [0, 2, 4, 6]], [[0, 7], [0, 4, 7], [0, 7]],
|
6021 |
+
[[0, 2, 7], [0, 2, 4, 7], [0, 2, 7]], [[0, 3, 7], [0, 3, 7, 10], [0, 3, 7]],
|
6022 |
+
[[0, 4, 7], [0, 4, 7, 9], [0, 4, 7]], [[0, 5, 7], [0, 5, 7, 9], [0, 5, 7]],
|
6023 |
+
[[0, 2, 4, 7], [0, 2, 4, 7, 9], [0, 2, 4, 7]],
|
6024 |
+
[[0, 2, 5, 7], [0, 2, 5, 7, 9], [0, 2, 5, 7]],
|
6025 |
+
[[0, 3, 5, 7], [0, 3, 5, 7, 10], [0, 3, 5, 7]], [[0, 8], [0, 3, 8], [8]],
|
6026 |
+
[[0, 2, 8], [0, 2, 5, 8], [0, 2, 8]], [[0, 3, 8], [0, 3, 5, 8], [0, 3, 8]],
|
6027 |
+
[[0, 4, 8], [2, 4, 8, 11], [0, 4, 9]], [[0, 5, 8], [0, 3, 5, 8], [0, 5, 8]],
|
6028 |
+
[[0, 6, 8], [0, 3, 6, 8], [0, 6, 8]],
|
6029 |
+
[[0, 2, 4, 8], [0, 2, 4, 6, 8], [0, 2, 4, 8]],
|
6030 |
+
[[0, 2, 5, 8], [0, 2, 5, 8, 10], [0, 2, 5, 8]],
|
6031 |
+
[[0, 2, 6, 8], [0, 2, 6, 8, 10], [0, 2, 6, 8]],
|
6032 |
+
[[0, 3, 5, 8], [0, 3, 5, 8, 10], [0, 3, 5, 8]],
|
6033 |
+
[[0, 3, 6, 8], [0, 3, 6, 8, 10], [0, 3, 6, 8]],
|
6034 |
+
[[0, 4, 6, 8], [2, 4, 6, 8, 11], [2, 6, 8, 11]],
|
6035 |
+
[[0, 2, 4, 6, 8], [2, 4, 6, 8, 11], [2, 6, 8, 11]], [[0, 9], [0, 4, 9], [9]],
|
6036 |
+
[[0, 2, 9], [0, 2, 6, 9], [0, 2, 9]], [[0, 3, 9], [0, 3, 5, 9], [0, 3, 9]],
|
6037 |
+
[[0, 4, 9], [0, 4, 7, 9], [0, 4, 9]], [[0, 5, 9], [0, 2, 5, 9], [0, 5, 9]],
|
6038 |
+
[[0, 6, 9], [0, 2, 6, 9], [0, 6, 9]], [[0, 7, 9], [0, 4, 7, 9], [0, 7, 9]],
|
6039 |
+
[[0, 2, 4, 9], [0, 2, 4, 7, 9], [0, 2, 4, 9]],
|
6040 |
+
[[0, 2, 5, 9], [0, 2, 5, 7, 9], [0, 2, 5, 9]],
|
6041 |
+
[[0, 2, 6, 9], [0, 2, 4, 6, 9], [0, 2, 6, 9]],
|
6042 |
+
[[0, 2, 7, 9], [0, 2, 4, 7, 9], [0, 2, 7, 9]],
|
6043 |
+
[[0, 3, 5, 9], [0, 3, 5, 7, 9], [0, 3, 5, 9]],
|
6044 |
+
[[0, 3, 6, 9], [0, 2, 4, 6, 9], [4, 6, 9]],
|
6045 |
+
[[0, 3, 7, 9], [0, 3, 5, 7, 9], [0, 3, 7, 9]],
|
6046 |
+
[[0, 4, 6, 9], [0, 2, 4, 6, 9], [0, 4, 6, 9]],
|
6047 |
+
[[0, 4, 7, 9], [0, 2, 4, 7, 9], [0, 4, 7, 9]],
|
6048 |
+
[[0, 5, 7, 9], [0, 2, 5, 7, 9], [0, 5, 7, 9]],
|
6049 |
+
[[0, 2, 4, 6, 9], [2, 4, 6, 9, 11], [0, 2, 4, 6, 9]],
|
6050 |
+
[[0, 2, 4, 7, 9], [2, 4, 7, 9, 11], [0, 2, 4, 7, 9]],
|
6051 |
+
[[0, 2, 5, 7, 9], [2, 5, 7, 9, 11], [7]],
|
6052 |
+
[[0, 3, 5, 7, 9], [2, 4, 6, 8, 11], [1, 4, 6, 8, 10]],
|
6053 |
+
[[0, 10], [2, 5, 10], [10]], [[0, 2, 10], [0, 2, 5, 10], [10]],
|
6054 |
+
[[0, 3, 10], [0, 3, 7, 10], [0, 3, 10]],
|
6055 |
+
[[0, 4, 10], [0, 4, 7, 10], [0, 4, 10]],
|
6056 |
+
[[0, 5, 10], [0, 2, 5, 10], [0, 5, 10]],
|
6057 |
+
[[0, 6, 10], [0, 3, 6, 10], [0, 6, 10]],
|
6058 |
+
[[0, 7, 10], [0, 4, 7, 10], [0, 7, 10]], [[0, 8, 10], [0, 3, 8, 10], [8]],
|
6059 |
+
[[0, 2, 4, 10], [0, 2, 4, 7, 10], [0, 4, 10]],
|
6060 |
+
[[0, 2, 5, 10], [0, 2, 5, 7, 10], [0, 2, 5, 10]],
|
6061 |
+
[[0, 2, 6, 10], [0, 2, 6, 8, 10], [8]],
|
6062 |
+
[[0, 2, 7, 10], [0, 2, 5, 7, 10], [2, 7, 10]],
|
6063 |
+
[[0, 2, 8, 10], [0, 2, 5, 8, 10], [8, 10]],
|
6064 |
+
[[0, 3, 5, 10], [0, 3, 5, 7, 10], [0, 3, 5, 10]],
|
6065 |
+
[[0, 3, 6, 10], [0, 3, 6, 8, 10], [0, 3, 6, 10]],
|
6066 |
+
[[0, 3, 7, 10], [0, 3, 5, 7, 10], [0, 3, 7, 10]],
|
6067 |
+
[[0, 3, 8, 10], [0, 3, 5, 8, 10], [0, 3, 8, 10]],
|
6068 |
+
[[0, 4, 6, 10], [0, 2, 4, 6, 10], [2]],
|
6069 |
+
[[0, 4, 7, 10], [0, 2, 4, 7, 10], [0, 4, 7, 10]],
|
6070 |
+
[[0, 4, 8, 10], [0, 2, 4, 8, 10], [0, 4, 8, 10]],
|
6071 |
+
[[0, 5, 7, 10], [0, 3, 5, 7, 10], [0, 5, 7, 10]],
|
6072 |
+
[[0, 5, 8, 10], [0, 3, 5, 8, 10], [10]],
|
6073 |
+
[[0, 6, 8, 10], [0, 3, 6, 8, 10], [6]],
|
6074 |
+
[[0, 2, 4, 6, 10], [0, 2, 4, 8, 10], [0, 2, 6, 8, 10]],
|
6075 |
+
[[0, 2, 4, 7, 10], [1, 3, 6, 9, 11], [0, 2, 5, 8, 10]],
|
6076 |
+
[[0, 2, 4, 8, 10], [1, 3, 7, 9, 11], [0, 2, 6, 8, 10]],
|
6077 |
+
[[0, 2, 5, 7, 10], [0, 3, 5, 7, 10], [5, 10]],
|
6078 |
+
[[0, 2, 5, 8, 10], [1, 4, 7, 9, 11], [8]],
|
6079 |
+
[[0, 2, 6, 8, 10], [2, 4, 6, 8, 10], [0, 2, 6, 8, 10]],
|
6080 |
+
[[0, 3, 5, 7, 10], [0, 2, 5, 7, 10], [9]],
|
6081 |
+
[[0, 3, 5, 8, 10], [1, 3, 5, 8, 10], [0, 3, 5, 8, 10]],
|
6082 |
+
[[0, 3, 6, 8, 10], [1, 3, 6, 8, 10], [0, 3, 6, 8, 10]],
|
6083 |
+
[[0, 4, 6, 8, 10], [0, 2, 4, 6, 9], [1, 3, 5, 8, 10]],
|
6084 |
+
[[0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10]],
|
6085 |
+
[[1], [1, 8], [1]], [[1, 3], [1, 5, 8], [1]], [[1, 4], [1, 4, 9], [9]],
|
6086 |
+
[[1, 5], [1, 5, 8], [1, 5]], [[1, 3, 5], [1, 3, 5, 10], [1, 3, 5]],
|
6087 |
+
[[1, 6], [1, 6, 10], [1, 6]], [[1, 3, 6], [1, 3, 6, 10], [1, 3, 6]],
|
6088 |
+
[[1, 4, 6], [1, 4, 6, 9], [1, 4, 6]], [[1, 7], [1, 4, 7], [1, 7]],
|
6089 |
+
[[1, 3, 7], [1, 3, 7, 10], [1, 3, 7]], [[1, 4, 7], [1, 4, 7, 9], [1, 4, 7]],
|
6090 |
+
[[1, 5, 7], [1, 5, 7, 10], [1, 5, 7]], [[1, 3, 5, 7], [1, 3, 5, 7, 10], [7]],
|
6091 |
+
[[1, 8], [1, 5, 8], [1, 8]], [[1, 3, 8], [1, 3, 5, 8], [1, 3, 8]],
|
6092 |
+
[[1, 4, 8], [1, 4, 8, 11], [1, 4, 8]], [[1, 5, 8], [1, 5, 8, 10], [1, 5, 8]],
|
6093 |
+
[[1, 6, 8], [1, 3, 6, 8], [1, 6, 8]],
|
6094 |
+
[[1, 3, 5, 8], [1, 3, 5, 8, 10], [1, 3, 5, 8]],
|
6095 |
+
[[1, 3, 6, 8], [1, 3, 6, 8, 10], [1, 3, 6, 8]],
|
6096 |
+
[[1, 4, 6, 8], [1, 4, 6, 8, 11], [1, 4, 6, 8]], [[1, 9], [1, 4, 9], [9]],
|
6097 |
+
[[1, 3, 9], [1, 3, 6, 9], [1, 3, 9]], [[1, 4, 9], [1, 4, 6, 9], [1, 4, 9]],
|
6098 |
+
[[1, 5, 9], [0, 3, 5, 9], [0, 5, 9]], [[1, 6, 9], [1, 4, 6, 9], [1, 6, 9]],
|
6099 |
+
[[1, 7, 9], [1, 4, 7, 9], [1, 7, 9]],
|
6100 |
+
[[1, 3, 5, 9], [0, 3, 5, 7, 9], [1, 5, 9]],
|
6101 |
+
[[1, 3, 6, 9], [1, 3, 6, 9, 11], [1, 3, 6, 9]],
|
6102 |
+
[[1, 3, 7, 9], [1, 3, 5, 7, 9], [1, 7]],
|
6103 |
+
[[1, 4, 6, 9], [1, 4, 6, 9, 11], [1, 4, 6, 9]],
|
6104 |
+
[[1, 4, 7, 9], [1, 4, 7, 9, 11], [1, 4, 7, 9]],
|
6105 |
+
[[1, 5, 7, 9], [1, 3, 7, 9, 11], [1, 5, 7, 9]],
|
6106 |
+
[[1, 3, 5, 7, 9], [2, 4, 6, 8, 11], [9]], [[1, 10], [1, 5, 10], [10]],
|
6107 |
+
[[1, 3, 10], [1, 3, 7, 10], [1, 3, 10]],
|
6108 |
+
[[1, 4, 10], [1, 4, 6, 10], [1, 4, 10]],
|
6109 |
+
[[1, 5, 10], [1, 5, 8, 10], [1, 5, 10]],
|
6110 |
+
[[1, 6, 10], [1, 4, 6, 10], [1, 6, 10]],
|
6111 |
+
[[1, 7, 10], [1, 3, 7, 10], [1, 7, 10]], [[1, 8, 10], [1, 5, 8, 10], [10]],
|
6112 |
+
[[1, 3, 5, 10], [1, 3, 5, 8, 10], [1, 3, 5, 10]],
|
6113 |
+
[[1, 3, 6, 10], [1, 3, 6, 8, 10], [1, 3, 6, 10]],
|
6114 |
+
[[1, 3, 7, 10], [1, 3, 5, 7, 10], [1, 3, 7, 10]],
|
6115 |
+
[[1, 3, 8, 10], [1, 3, 5, 8, 10], [1, 3, 8, 10]],
|
6116 |
+
[[1, 4, 6, 10], [1, 4, 6, 8, 10], [1, 4, 6, 10]],
|
6117 |
+
[[1, 4, 7, 10], [0, 2, 4, 7, 10], [0, 4, 7, 10]],
|
6118 |
+
[[1, 4, 8, 10], [1, 4, 6, 8, 10], [1, 4, 8, 10]],
|
6119 |
+
[[1, 5, 7, 10], [1, 3, 5, 7, 10], [1, 5, 7, 10]],
|
6120 |
+
[[1, 5, 8, 10], [1, 3, 5, 8, 10], [1, 5, 8, 10]],
|
6121 |
+
[[1, 6, 8, 10], [1, 3, 6, 8, 10], [1, 6, 8, 10]],
|
6122 |
+
[[1, 3, 5, 7, 10], [2, 4, 6, 8, 11], [0, 3, 5, 7, 9]],
|
6123 |
+
[[1, 3, 5, 8, 10], [0, 3, 5, 8, 10], [6, 8, 10]],
|
6124 |
+
[[1, 3, 6, 8, 10], [0, 3, 6, 8, 10], [8]],
|
6125 |
+
[[1, 4, 6, 8, 10], [0, 3, 5, 7, 9], [2, 4, 6, 8, 11]],
|
6126 |
+
[[1, 11], [2, 6, 11], [11]], [[1, 3, 11], [1, 3, 6, 11], [11]],
|
6127 |
+
[[1, 4, 11], [1, 4, 8, 11], [1]], [[1, 5, 11], [1, 5, 8, 11], [1, 5, 11]],
|
6128 |
+
[[1, 6, 11], [1, 4, 6, 11], [1, 6, 11]],
|
6129 |
+
[[1, 7, 11], [1, 4, 7, 11], [1, 7, 11]],
|
6130 |
+
[[1, 8, 11], [1, 4, 8, 11], [1, 8, 11]], [[1, 9, 11], [1, 4, 9, 11], [9]],
|
6131 |
+
[[1, 3, 5, 11], [1, 3, 5, 8, 11], [1, 3, 5, 11]],
|
6132 |
+
[[1, 3, 6, 11], [1, 3, 6, 8, 11], [1, 3, 6, 11]],
|
6133 |
+
[[1, 3, 7, 11], [1, 3, 7, 9, 11], [0]],
|
6134 |
+
[[1, 3, 8, 11], [1, 3, 6, 8, 11], [1, 3, 8, 11]],
|
6135 |
+
[[1, 3, 9, 11], [1, 3, 6, 9, 11], [1, 3, 9, 11]],
|
6136 |
+
[[1, 4, 6, 11], [1, 4, 6, 9, 11], [1, 4, 6, 11]],
|
6137 |
+
[[1, 4, 7, 11], [1, 4, 7, 9, 11], [1, 4, 7, 11]],
|
6138 |
+
[[1, 4, 8, 11], [1, 4, 6, 8, 11], [1, 4, 8, 11]],
|
6139 |
+
[[1, 4, 9, 11], [1, 4, 6, 9, 11], [1, 4, 9, 11]],
|
6140 |
+
[[1, 5, 7, 11], [0, 4, 6, 8, 10], [5, 7, 9, 11]],
|
6141 |
+
[[1, 5, 8, 11], [1, 3, 5, 8, 11], [1, 5, 8, 11]],
|
6142 |
+
[[1, 5, 9, 11], [1, 5, 7, 9, 11], [9]],
|
6143 |
+
[[1, 6, 8, 11], [1, 3, 6, 8, 11], [1, 6, 8, 11]],
|
6144 |
+
[[1, 6, 9, 11], [1, 4, 6, 9, 11], [1, 6, 9, 11]],
|
6145 |
+
[[1, 7, 9, 11], [1, 4, 7, 9, 11], [1, 7, 9, 11]],
|
6146 |
+
[[1, 3, 5, 7, 11], [0, 2, 4, 6, 8], [7, 9]],
|
6147 |
+
[[1, 3, 5, 8, 11], [0, 2, 4, 7, 10], [1, 3, 6, 9, 11]],
|
6148 |
+
[[1, 3, 5, 9, 11], [1, 3, 7, 9, 11], [0, 2, 6, 8, 10]],
|
6149 |
+
[[1, 3, 6, 8, 11], [1, 4, 6, 8, 11], [6, 8, 11]],
|
6150 |
+
[[1, 3, 6, 9, 11], [0, 2, 5, 8, 10], [1, 4, 7, 9, 11]],
|
6151 |
+
[[1, 3, 7, 9, 11], [1, 3, 6, 9, 11], [11]],
|
6152 |
+
[[1, 4, 6, 8, 11], [1, 4, 6, 9, 11], [9, 11]],
|
6153 |
+
[[1, 4, 6, 9, 11], [2, 4, 6, 9, 11], [1, 4, 6, 9, 11]],
|
6154 |
+
[[1, 4, 7, 9, 11], [2, 4, 7, 9, 11], [7, 9, 11]],
|
6155 |
+
[[1, 5, 7, 9, 11], [2, 4, 7, 9, 11], [5, 7, 9]],
|
6156 |
+
[[1, 3, 5, 7, 9, 11], [0, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 11]],
|
6157 |
+
[[2], [2, 9], [2]], [[2, 4], [2, 6, 9], [2]], [[2, 5], [2, 5, 9], [2]],
|
6158 |
+
[[2, 6], [2, 6, 9], [2]], [[2, 4, 6], [2, 4, 6, 9], [2, 4, 6]],
|
6159 |
+
[[2, 7], [2, 7, 11], [2, 7]], [[2, 4, 7], [2, 4, 7, 11], [2, 4, 7]],
|
6160 |
+
[[2, 5, 7], [2, 5, 7, 11], [2, 5, 7]], [[2, 8], [4, 8, 11], [4]],
|
6161 |
+
[[2, 4, 8], [2, 4, 8, 11], [2, 4, 8]], [[2, 5, 8], [2, 5, 8, 10], [2, 5, 8]],
|
6162 |
+
[[2, 6, 8], [2, 6, 8, 11], [2, 6, 8]],
|
6163 |
+
[[2, 4, 6, 8], [2, 4, 6, 8, 11], [2, 4, 6, 8]], [[2, 9], [2, 6, 9], [2, 9]],
|
6164 |
+
[[2, 4, 9], [2, 4, 6, 9], [2, 4, 9]], [[2, 5, 9], [0, 2, 5, 9], [2, 5, 9]],
|
6165 |
+
[[2, 6, 9], [2, 6, 9, 11], [2, 6, 9]], [[2, 7, 9], [2, 7, 9, 11], [2, 7, 9]],
|
6166 |
+
[[2, 4, 6, 9], [2, 4, 6, 9, 11], [2, 4, 6, 9]],
|
6167 |
+
[[2, 4, 7, 9], [2, 4, 7, 9, 11], [2, 4, 7, 9]],
|
6168 |
+
[[2, 5, 7, 9], [0, 2, 5, 7, 9], [2, 5, 7, 9]], [[2, 10], [2, 5, 10], [10]],
|
6169 |
+
[[2, 4, 10], [2, 4, 7, 10], [2, 4, 10]],
|
6170 |
+
[[2, 5, 10], [2, 5, 7, 10], [2, 5, 10]],
|
6171 |
+
[[2, 6, 10], [1, 4, 6, 10], [1, 6, 10]],
|
6172 |
+
[[2, 7, 10], [2, 5, 7, 10], [2, 7, 10]],
|
6173 |
+
[[2, 8, 10], [2, 5, 8, 10], [2, 8, 10]],
|
6174 |
+
[[2, 4, 6, 10], [0, 2, 4, 6, 10], [2, 4, 6, 10]],
|
6175 |
+
[[2, 4, 7, 10], [0, 2, 4, 7, 10], [2, 4, 7, 10]],
|
6176 |
+
[[2, 4, 8, 10], [2, 4, 7, 9, 11], [2, 4, 7, 11]],
|
6177 |
+
[[2, 5, 7, 10], [0, 2, 5, 7, 10], [2, 5, 7, 10]],
|
6178 |
+
[[2, 5, 8, 10], [0, 2, 5, 8, 10], [2, 5, 8, 10]],
|
6179 |
+
[[2, 6, 8, 10], [1, 3, 5, 7, 10], [1, 7]],
|
6180 |
+
[[2, 4, 6, 8, 10], [0, 2, 6, 8, 10], [2, 4, 6, 8, 10]],
|
6181 |
+
[[2, 11], [2, 7, 11], [7]], [[2, 4, 11], [2, 4, 8, 11], [2, 4, 11]],
|
6182 |
+
[[2, 5, 11], [2, 5, 7, 11], [2, 5, 11]],
|
6183 |
+
[[2, 6, 11], [2, 6, 9, 11], [2, 6, 11]],
|
6184 |
+
[[2, 7, 11], [2, 4, 7, 11], [2, 7, 11]],
|
6185 |
+
[[2, 8, 11], [2, 4, 8, 11], [2, 8, 11]],
|
6186 |
+
[[2, 9, 11], [2, 6, 9, 11], [2, 9, 11]],
|
6187 |
+
[[2, 4, 6, 11], [2, 4, 6, 9, 11], [2, 4, 6, 11]],
|
6188 |
+
[[2, 4, 7, 11], [2, 4, 7, 9, 11], [2, 4, 7, 11]],
|
6189 |
+
[[2, 4, 8, 11], [2, 4, 6, 8, 11], [2, 4, 8, 11]],
|
6190 |
+
[[2, 4, 9, 11], [2, 4, 7, 9, 11], [2, 4, 9, 11]],
|
6191 |
+
[[2, 5, 7, 11], [2, 5, 7, 9, 11], [2, 5, 7, 11]],
|
6192 |
+
[[2, 5, 8, 11], [1, 3, 5, 8, 11], [1, 5, 8, 11]],
|
6193 |
+
[[2, 5, 9, 11], [2, 5, 7, 9, 11], [2, 5, 9, 11]],
|
6194 |
+
[[2, 6, 8, 11], [2, 4, 6, 8, 11], [2, 6, 8, 11]],
|
6195 |
+
[[2, 6, 9, 11], [2, 4, 6, 9, 11], [2, 6, 9, 11]],
|
6196 |
+
[[2, 7, 9, 11], [2, 4, 7, 9, 11], [2, 7, 9, 11]],
|
6197 |
+
[[2, 4, 6, 8, 11], [2, 4, 6, 9, 11], [2, 4, 6, 8, 11]],
|
6198 |
+
[[2, 4, 6, 9, 11], [2, 4, 7, 9, 11], [2, 7, 9]],
|
6199 |
+
[[2, 4, 7, 9, 11], [0, 2, 4, 7, 9], [11]],
|
6200 |
+
[[2, 5, 7, 9, 11], [2, 4, 7, 9, 11], [2, 7, 9, 11]], [[3], [3, 10], [3]],
|
6201 |
+
[[3, 5], [3, 7, 10], [3]], [[3, 6], [3, 6, 11], [11]],
|
6202 |
+
[[3, 7], [3, 7, 10], [3]], [[3, 5, 7], [3, 5, 7, 10], [3, 5, 7]],
|
6203 |
+
[[3, 8], [0, 3, 8], [3, 8]], [[3, 5, 8], [0, 3, 5, 8], [8]],
|
6204 |
+
[[3, 6, 8], [0, 3, 6, 8], [3, 6, 8]], [[3, 9], [0, 3, 9], [3, 9]],
|
6205 |
+
[[3, 5, 9], [0, 3, 5, 9], [3, 5, 9]], [[3, 6, 9], [3, 6, 9, 11], [3, 6, 9]],
|
6206 |
+
[[3, 7, 9], [0, 3, 7, 9], [3, 7, 9]],
|
6207 |
+
[[3, 5, 7, 9], [0, 3, 5, 7, 9], [0, 3, 5, 9]], [[3, 10], [3, 7, 10], [3, 10]],
|
6208 |
+
[[3, 5, 10], [3, 5, 7, 10], [3, 5, 10]],
|
6209 |
+
[[3, 6, 10], [1, 3, 6, 10], [3, 6, 10]],
|
6210 |
+
[[3, 7, 10], [0, 3, 7, 10], [3, 7, 10]],
|
6211 |
+
[[3, 8, 10], [0, 3, 8, 10], [3, 8, 10]],
|
6212 |
+
[[3, 5, 7, 10], [0, 3, 5, 7, 10], [3, 5, 7, 10]],
|
6213 |
+
[[3, 5, 8, 10], [0, 3, 5, 8, 10], [3, 5, 8, 10]],
|
6214 |
+
[[3, 6, 8, 10], [1, 3, 6, 8, 10], [3, 6, 8, 10]], [[3, 11], [3, 6, 11], [11]],
|
6215 |
+
[[3, 5, 11], [3, 5, 8, 11], [3, 5, 11]],
|
6216 |
+
[[3, 6, 11], [3, 6, 9, 11], [3, 6, 11]],
|
6217 |
+
[[3, 7, 11], [2, 5, 7, 11], [2, 7, 11]],
|
6218 |
+
[[3, 8, 11], [3, 6, 8, 11], [3, 8, 11]],
|
6219 |
+
[[3, 9, 11], [3, 6, 9, 11], [3, 9, 11]],
|
6220 |
+
[[3, 5, 7, 11], [3, 5, 7, 9, 11], [3, 5, 7, 11]],
|
6221 |
+
[[3, 5, 8, 11], [1, 3, 5, 8, 11], [3, 5, 8, 11]],
|
6222 |
+
[[3, 5, 9, 11], [3, 5, 7, 9, 11], [5, 7, 9, 11]],
|
6223 |
+
[[3, 6, 8, 11], [1, 3, 6, 8, 11], [3, 6, 8, 11]],
|
6224 |
+
[[3, 6, 9, 11], [1, 3, 6, 9, 11], [3, 6, 9, 11]],
|
6225 |
+
[[3, 7, 9, 11], [2, 4, 7, 9, 11], [7, 9, 11]],
|
6226 |
+
[[3, 5, 7, 9, 11], [2, 5, 7, 9, 11], [2, 5, 7, 11]], [[4], [4, 11], [4]],
|
6227 |
+
[[4, 6], [4, 7, 11], [4]], [[4, 7], [0, 4, 7], [0]], [[4, 8], [4, 8, 11], [4]],
|
6228 |
+
[[4, 6, 8], [4, 6, 8, 11], [4]], [[4, 9], [1, 4, 9], [4, 9]],
|
6229 |
+
[[4, 6, 9], [1, 4, 6, 9], [4, 6, 9]], [[4, 7, 9], [1, 4, 7, 9], [4, 7, 9]],
|
6230 |
+
[[4, 10], [4, 7, 10], [4, 10]], [[4, 6, 10], [1, 4, 6, 10], [4, 6, 10]],
|
6231 |
+
[[4, 7, 10], [0, 4, 7, 10], [4, 7, 10]], [[4, 8, 10], [1, 4, 8, 10], [1]],
|
6232 |
+
[[4, 6, 8, 10], [1, 4, 6, 8, 10], [6]], [[4, 11], [4, 8, 11], [4, 11]],
|
6233 |
+
[[4, 6, 11], [4, 6, 8, 11], [4, 6, 11]],
|
6234 |
+
[[4, 7, 11], [2, 4, 7, 11], [4, 7, 11]],
|
6235 |
+
[[4, 8, 11], [2, 4, 8, 11], [4, 8, 11]],
|
6236 |
+
[[4, 9, 11], [2, 4, 9, 11], [4, 9, 11]],
|
6237 |
+
[[4, 6, 8, 11], [1, 4, 6, 8, 11], [4, 6, 8, 11]],
|
6238 |
+
[[4, 6, 9, 11], [2, 4, 6, 9, 11], [4, 6, 9, 11]],
|
6239 |
+
[[4, 7, 9, 11], [2, 4, 7, 9, 11], [4, 7, 9, 11]], [[5], [0, 5, 9], [5]],
|
6240 |
+
[[5, 7], [0, 4, 7], [0]], [[5, 8], [0, 5, 8], [5]], [[5, 9], [0, 5, 9], [5]],
|
6241 |
+
[[5, 7, 9], [0, 4, 7, 9], [5]], [[5, 10], [2, 5, 10], [5, 10]],
|
6242 |
+
[[5, 7, 10], [2, 5, 7, 10], [7]], [[5, 8, 10], [2, 5, 8, 10], [5, 8, 10]],
|
6243 |
+
[[5, 11], [0, 5, 9], [5]], [[5, 7, 11], [2, 5, 7, 11], [5, 7, 11]],
|
6244 |
+
[[5, 8, 11], [1, 5, 8, 11], [5, 8, 11]],
|
6245 |
+
[[5, 9, 11], [2, 5, 9, 11], [5, 9, 11]],
|
6246 |
+
[[5, 7, 9, 11], [2, 5, 7, 9, 11], [5, 7, 9]], [[6], [1, 6], [6]],
|
6247 |
+
[[6, 8], [1, 5, 8], [8]], [[6, 9], [2, 6, 9], [2]], [[6, 10], [1, 6, 10], [6]],
|
6248 |
+
[[6, 8, 10], [1, 5, 8, 10], [6, 8, 10]], [[6, 11], [3, 6, 11], [6, 11]],
|
6249 |
+
[[6, 8, 11], [3, 6, 8, 11], [6, 8, 11]],
|
6250 |
+
[[6, 9, 11], [3, 6, 9, 11], [6, 9, 11]], [[7], [2, 7, 11], [7]],
|
6251 |
+
[[7, 9], [2, 6, 9], [2]], [[7, 10], [2, 7, 10], [7]],
|
6252 |
+
[[7, 11], [2, 7, 11], [7]], [[7, 9, 11], [2, 7, 9, 11], [7, 9, 11]],
|
6253 |
+
[[8], [3, 8], [8]], [[8, 10], [3, 7, 10], [3]], [[8, 11], [4, 8, 11], [4]],
|
6254 |
+
[[9], [4, 9], [9]], [[9, 11], [4, 8, 11], [4]], [[10], [2, 5, 10], [10]],
|
6255 |
+
[[11], [6, 11], [11]]]
|
6256 |
+
|
6257 |
+
###################################################################################
|
6258 |
+
|
6259 |
+
ALL_CHORDS_TRIPLETS_FILTERED = [[[0], [0, 4, 7], [7]], [[0, 3], [0, 3, 7], [0]],
|
6260 |
+
[[0, 3, 5], [0, 3, 5, 9], [5]], [[0, 3, 5, 8], [0, 3, 7, 10], [0]],
|
6261 |
+
[[0, 3, 5, 9], [0, 3, 7, 10], [10]], [[0, 3, 5, 10], [0, 3, 5, 9], [5]],
|
6262 |
+
[[0, 3, 7], [0, 3, 7, 10], [0]], [[0, 3, 7, 10], [0, 3, 5, 9], [2, 5, 10]],
|
6263 |
+
[[0, 3, 8], [0, 3, 5, 8], [8]], [[0, 3, 9], [0, 3, 5, 9], [5]],
|
6264 |
+
[[0, 3, 10], [0, 3, 7, 10], [0]], [[0, 4], [0, 4, 7], [0]],
|
6265 |
+
[[0, 4, 6], [0, 4, 6, 9], [4]], [[0, 4, 6, 9], [1, 4, 6, 9], [9]],
|
6266 |
+
[[0, 4, 6, 10], [0, 4, 7, 10], [0, 4, 10]], [[0, 4, 7], [0, 4, 7, 10], [0]],
|
6267 |
+
[[0, 4, 7, 10], [1, 4, 7, 10], [0]], [[0, 4, 8], [0, 4, 7, 10], [0, 5, 8]],
|
6268 |
+
[[0, 4, 9], [0, 4, 6, 9], [9]], [[0, 4, 10], [0, 4, 7, 10], [0]],
|
6269 |
+
[[0, 5], [0, 5, 9], [5]], [[0, 5, 8], [0, 3, 5, 8], [5]],
|
6270 |
+
[[0, 5, 9], [0, 3, 5, 9], [5]], [[0, 5, 10], [0, 3, 5, 10], [10]],
|
6271 |
+
[[0, 6], [0, 6, 9], [9]], [[0, 6, 9], [0, 4, 6, 9], [6]],
|
6272 |
+
[[0, 6, 10], [0, 4, 7, 10], [10]], [[0, 7], [0, 4, 7], [0]],
|
6273 |
+
[[0, 7, 10], [0, 4, 7, 10], [0]], [[0, 8], [0, 3, 8], [8]],
|
6274 |
+
[[0, 9], [0, 4, 9], [9]], [[0, 10], [2, 5, 10], [10]], [[1], [1, 8], [8]],
|
6275 |
+
[[1, 4], [1, 4, 9], [9]], [[1, 4, 6], [1, 4, 6, 9], [6]],
|
6276 |
+
[[1, 4, 6, 9], [1, 4, 8, 11], [4]], [[1, 4, 6, 10], [0, 3, 5, 9], [5]],
|
6277 |
+
[[1, 4, 6, 11], [1, 4, 6, 9], [6]], [[1, 4, 7], [1, 4, 7, 10], [10]],
|
6278 |
+
[[1, 4, 7, 10], [0, 4, 7, 10], [0]],
|
6279 |
+
[[1, 4, 7, 11], [1, 4, 6, 10], [1, 6, 10]], [[1, 4, 8], [1, 4, 8, 11], [1]],
|
6280 |
+
[[1, 4, 8, 11], [1, 4, 6, 9], [1, 4, 9]], [[1, 4, 9], [1, 4, 6, 9], [9]],
|
6281 |
+
[[1, 4, 10], [1, 4, 6, 10], [6]], [[1, 4, 11], [1, 4, 8, 11], [1]],
|
6282 |
+
[[1, 5], [1, 5, 8], [1]], [[1, 5, 8], [1, 5, 8, 11], [1]],
|
6283 |
+
[[1, 5, 8, 11], [2, 5, 8, 11], [1]], [[1, 5, 9], [0, 3, 5, 9], [0, 5, 9]],
|
6284 |
+
[[1, 5, 10], [0, 4, 7, 10], [0]], [[1, 5, 11], [1, 5, 8, 11], [11]],
|
6285 |
+
[[1, 6], [1, 6, 10], [6]], [[1, 6, 9], [1, 4, 6, 9], [6]],
|
6286 |
+
[[1, 6, 10], [1, 4, 6, 10], [6]], [[1, 6, 11], [1, 4, 6, 11], [11]],
|
6287 |
+
[[1, 7], [1, 4, 7], [4]], [[1, 7, 10], [1, 4, 7, 10], [4]],
|
6288 |
+
[[1, 7, 11], [1, 4, 7, 11], [7]], [[1, 8], [1, 5, 8], [1]],
|
6289 |
+
[[1, 8, 11], [1, 4, 8, 11], [1]], [[1, 9], [1, 4, 9], [9]],
|
6290 |
+
[[1, 10], [1, 5, 10], [10]], [[1, 11], [2, 6, 11], [11]], [[2], [2, 9], [9]],
|
6291 |
+
[[2, 5], [2, 5, 9], [2]], [[2, 5, 8], [2, 5, 8, 11], [2]],
|
6292 |
+
[[2, 5, 8, 11], [1, 4, 7, 10], [0, 3, 8]],
|
6293 |
+
[[2, 5, 9], [0, 3, 5, 9], [2, 5, 10]], [[2, 5, 10], [0, 3, 5, 9], [2, 10]],
|
6294 |
+
[[2, 5, 11], [2, 5, 8, 11], [8]], [[2, 6], [2, 6, 9], [2]],
|
6295 |
+
[[2, 6, 9], [1, 4, 6, 9], [1, 4, 9]], [[2, 6, 10], [1, 4, 6, 10], [1, 6, 10]],
|
6296 |
+
[[2, 6, 11], [1, 4, 6, 10], [1, 6, 10]], [[2, 7], [2, 7, 11], [7]],
|
6297 |
+
[[2, 7, 10], [0, 4, 7, 10], [0]], [[2, 7, 11], [1, 4, 6, 9], [1, 4, 9]],
|
6298 |
+
[[2, 8], [4, 8, 11], [4]], [[2, 8, 11], [2, 5, 8, 11], [4]],
|
6299 |
+
[[2, 9], [2, 6, 9], [2]], [[2, 10], [2, 5, 10], [10]],
|
6300 |
+
[[2, 11], [2, 7, 11], [7]], [[3], [3, 10], [10]], [[3, 5], [3, 7, 10], [3]],
|
6301 |
+
[[3, 5, 8], [0, 3, 5, 8], [8]], [[3, 5, 8, 11], [2, 5, 8, 11], [2]],
|
6302 |
+
[[3, 5, 9], [0, 3, 5, 9], [5]], [[3, 5, 10], [0, 3, 5, 10], [5, 10]],
|
6303 |
+
[[3, 5, 11], [3, 5, 8, 11], [5]], [[3, 7], [3, 7, 10], [3]],
|
6304 |
+
[[3, 7, 10], [0, 3, 7, 10], [10]], [[3, 7, 11], [0, 3, 7, 10], [3, 7, 10]],
|
6305 |
+
[[3, 8], [0, 3, 8], [8]], [[3, 8, 11], [3, 5, 8, 11], [11]],
|
6306 |
+
[[3, 9], [0, 3, 9], [9]], [[3, 10], [3, 7, 10], [3]],
|
6307 |
+
[[3, 11], [3, 8, 11], [8]], [[4], [4, 11], [11]], [[4, 6], [4, 7, 11], [4]],
|
6308 |
+
[[4, 6, 9], [1, 4, 6, 9], [9]], [[4, 6, 10], [1, 4, 6, 10], [6]],
|
6309 |
+
[[4, 6, 11], [1, 4, 6, 11], [11]], [[4, 7], [0, 4, 7], [0]],
|
6310 |
+
[[4, 7, 10], [0, 4, 7, 10], [0]], [[4, 7, 11], [1, 4, 7, 11], [11]],
|
6311 |
+
[[4, 8], [4, 8, 11], [4]], [[4, 8, 11], [1, 4, 8, 11], [4]],
|
6312 |
+
[[4, 9], [1, 4, 9], [9]], [[4, 10], [4, 7, 10], [7]],
|
6313 |
+
[[4, 11], [4, 8, 11], [4]], [[5], [0, 5, 9], [0]], [[5, 8], [0, 5, 8], [5]],
|
6314 |
+
[[5, 8, 11], [1, 5, 8, 11], [1]], [[5, 9], [0, 5, 9], [5]],
|
6315 |
+
[[5, 10], [2, 5, 10], [10]], [[5, 11], [0, 5, 9], [5]], [[6], [1, 6], [1]],
|
6316 |
+
[[6, 9], [2, 6, 9], [2]], [[6, 10], [1, 6, 10], [6]],
|
6317 |
+
[[6, 11], [2, 6, 11], [11]], [[7], [2, 7, 11], [2]],
|
6318 |
+
[[7, 10], [2, 7, 10], [7]], [[7, 11], [2, 7, 11], [7]], [[8], [3, 8], [3]],
|
6319 |
+
[[8, 11], [4, 8, 11], [4]], [[9], [4, 9], [4]], [[10], [2, 5, 10], [5]],
|
6320 |
+
[[11], [6, 11], [6]]]
|
6321 |
+
|
6322 |
+
###################################################################################
|
6323 |
+
|
6324 |
+
def pitches_to_tones(pitches):
|
6325 |
+
return [p % 12 for p in pitches]
|
6326 |
+
|
6327 |
+
###################################################################################
|
6328 |
+
|
6329 |
+
def tones_to_pitches(tones, base_octave=5):
|
6330 |
+
return [(base_octave * 12) + t for t in tones]
|
6331 |
+
|
6332 |
+
###################################################################################
|
6333 |
+
|
6334 |
+
def find_closest_value(lst, val):
|
6335 |
+
|
6336 |
+
closest_value = min(lst, key=lambda x: abs(val - x))
|
6337 |
+
closest_value_indexes = [i for i in range(len(lst)) if lst[i] == closest_value]
|
6338 |
+
|
6339 |
+
return [closest_value, abs(val - closest_value), closest_value_indexes]
|
6340 |
+
|
6341 |
+
###################################################################################
|
6342 |
+
|
6343 |
+
def transpose_tones_chord(tones_chord, transpose_value=0):
|
6344 |
+
return sorted([((60+t)+transpose_value) % 12 for t in sorted(set(tones_chord))])
|
6345 |
+
|
6346 |
+
###################################################################################
|
6347 |
+
|
6348 |
+
def transpose_tones(tones, transpose_value=0):
|
6349 |
+
return [((60+t)+transpose_value) % 12 for t in tones]
|
6350 |
+
|
6351 |
+
###################################################################################
|
6352 |
+
|
6353 |
+
def transpose_pitches_chord(pitches_chord, transpose_value=0):
|
6354 |
+
return [max(1, min(127, p+transpose_value)) for p in sorted(set(pitches_chord), reverse=True)]
|
6355 |
+
|
6356 |
+
###################################################################################
|
6357 |
+
|
6358 |
+
def transpose_pitches(pitches, transpose_value=0):
|
6359 |
+
return [max(1, min(127, p+transpose_value)) for p in pitches]
|
6360 |
+
|
6361 |
+
###################################################################################
|
6362 |
+
|
6363 |
+
def reverse_enhanced_score_notes(enhanced_score_notes):
|
6364 |
+
|
6365 |
+
score = recalculate_score_timings(enhanced_score_notes)
|
6366 |
+
|
6367 |
+
cscore = chordify_score([1000, score])
|
6368 |
+
|
6369 |
+
abs_dtimes = []
|
6370 |
+
|
6371 |
+
for i, t in enumerate(cscore[:-1]):
|
6372 |
+
abs_dtimes.append(cscore[i+1][0][1])
|
6373 |
+
abs_dtimes.append(cscore[-1][0][1]+cscore[-1][0][2])
|
6374 |
+
|
6375 |
+
new_dtimes = []
|
6376 |
+
pt = abs_dtimes[-1]
|
6377 |
+
|
6378 |
+
for t in abs_dtimes[::-1]:
|
6379 |
+
new_dtimes.append(abs(pt-t))
|
6380 |
+
pt = t
|
6381 |
+
|
6382 |
+
new_mel = copy.deepcopy(cscore[::-1])
|
6383 |
+
|
6384 |
+
time = 0
|
6385 |
+
|
6386 |
+
for i, t in enumerate(new_mel):
|
6387 |
+
time += new_dtimes[i]
|
6388 |
+
for tt in t:
|
6389 |
+
tt[1] = time
|
6390 |
+
|
6391 |
+
return recalculate_score_timings(flatten(new_mel))
|
6392 |
+
|
6393 |
+
###################################################################################
|
6394 |
+
|
6395 |
+
def count_patterns(lst, sublist):
|
6396 |
+
count = 0
|
6397 |
+
idx = 0
|
6398 |
+
for i in range(len(lst) - len(sublist) + 1):
|
6399 |
+
if lst[idx:idx + len(sublist)] == sublist:
|
6400 |
+
count += 1
|
6401 |
+
idx += len(sublist)
|
6402 |
+
else:
|
6403 |
+
idx += 1
|
6404 |
+
return count
|
6405 |
+
|
6406 |
+
def find_lrno_patterns(seq):
|
6407 |
+
|
6408 |
+
all_seqs = Counter()
|
6409 |
+
|
6410 |
+
max_pat_len = math.ceil(len(seq) / 2)
|
6411 |
+
|
6412 |
+
num_iter = 0
|
6413 |
+
|
6414 |
+
for i in range(len(seq)):
|
6415 |
+
for j in range(i+1, len(seq)+1):
|
6416 |
+
if j-i <= max_pat_len:
|
6417 |
+
all_seqs[tuple(seq[i:j])] += 1
|
6418 |
+
num_iter += 1
|
6419 |
+
|
6420 |
+
max_count = 0
|
6421 |
+
max_len = 0
|
6422 |
+
|
6423 |
+
for val, count in all_seqs.items():
|
6424 |
+
|
6425 |
+
if max_len < len(val):
|
6426 |
+
max_count = max(2, count)
|
6427 |
+
|
6428 |
+
if count > 1:
|
6429 |
+
max_len = max(max_len, len(val))
|
6430 |
+
pval = val
|
6431 |
+
|
6432 |
+
max_pats = []
|
6433 |
+
|
6434 |
+
for val, count in all_seqs.items():
|
6435 |
+
if count == max_count and len(val) == max_len:
|
6436 |
+
max_pats.append(val)
|
6437 |
+
|
6438 |
+
found_patterns = []
|
6439 |
+
|
6440 |
+
for pat in max_pats:
|
6441 |
+
count = count_patterns(seq, list(pat))
|
6442 |
+
if count > 1:
|
6443 |
+
found_patterns.append([count, len(pat), pat])
|
6444 |
+
|
6445 |
+
return found_patterns
|
6446 |
+
|
6447 |
+
###################################################################################
|
6448 |
+
|
6449 |
+
def delta_pitches(escore_notes, pitches_index=4):
|
6450 |
+
|
6451 |
+
pitches = [p[pitches_index] for p in escore_notes]
|
6452 |
+
|
6453 |
+
return [a-b for a, b in zip(pitches[:-1], pitches[1:])]
|
6454 |
+
|
6455 |
+
###################################################################################
|
6456 |
+
|
6457 |
+
def split_list(lst, val):
|
6458 |
+
return [lst[i:j] for i, j in zip([0] + [k + 1 for k, x in enumerate(lst) if x == val], [k for k, x in enumerate(lst) if x == val] + [len(lst)]) if j > i]
|
6459 |
+
|
6460 |
+
###################################################################################
|
6461 |
+
|
6462 |
+
def even_timings(escore_notes,
|
6463 |
+
times_idx=1,
|
6464 |
+
durs_idx=2
|
6465 |
+
):
|
6466 |
+
|
6467 |
+
esn = copy.deepcopy(escore_notes)
|
6468 |
+
|
6469 |
+
for e in esn:
|
6470 |
+
|
6471 |
+
if e[times_idx] != 0:
|
6472 |
+
if e[times_idx] % 2 != 0:
|
6473 |
+
e[times_idx] += 1
|
6474 |
+
|
6475 |
+
if e[durs_idx] % 2 != 0:
|
6476 |
+
e[durs_idx] += 1
|
6477 |
+
|
6478 |
+
return esn
|
6479 |
+
|
6480 |
+
###################################################################################
|
6481 |
+
|
6482 |
+
def delta_score_to_abs_score(delta_score_notes,
|
6483 |
+
times_idx=1
|
6484 |
+
):
|
6485 |
+
|
6486 |
+
abs_score = copy.deepcopy(delta_score_notes)
|
6487 |
+
|
6488 |
+
abs_time = 0
|
6489 |
+
|
6490 |
+
for i, e in enumerate(delta_score_notes):
|
6491 |
+
|
6492 |
+
dtime = e[times_idx]
|
6493 |
+
|
6494 |
+
abs_time += dtime
|
6495 |
+
|
6496 |
+
abs_score[i][times_idx] = abs_time
|
6497 |
+
|
6498 |
+
return abs_score
|
6499 |
+
|
6500 |
+
###################################################################################
|
6501 |
+
|
6502 |
+
|
6503 |
+
def adjust_numbers_to_sum(numbers, target_sum):
|
6504 |
+
|
6505 |
+
current_sum = sum(numbers)
|
6506 |
+
difference = target_sum - current_sum
|
6507 |
+
|
6508 |
+
non_zero_elements = [(i, num) for i, num in enumerate(numbers) if num != 0]
|
6509 |
+
|
6510 |
+
total_non_zero = sum(num for _, num in non_zero_elements)
|
6511 |
+
|
6512 |
+
increments = []
|
6513 |
+
for i, num in non_zero_elements:
|
6514 |
+
proportion = num / total_non_zero
|
6515 |
+
increment = proportion * difference
|
6516 |
+
increments.append(increment)
|
6517 |
+
|
6518 |
+
for idx, (i, num) in enumerate(non_zero_elements):
|
6519 |
+
numbers[i] += int(round(increments[idx]))
|
6520 |
+
|
6521 |
+
current_sum = sum(numbers)
|
6522 |
+
difference = target_sum - current_sum
|
6523 |
+
non_zero_indices = [i for i, num in enumerate(numbers) if num != 0]
|
6524 |
+
|
6525 |
+
for i in range(abs(difference)):
|
6526 |
+
numbers[non_zero_indices[i % len(non_zero_indices)]] += 1 if difference > 0 else -1
|
6527 |
+
|
6528 |
+
return numbers
|
6529 |
+
|
6530 |
+
###################################################################################
|
6531 |
+
|
6532 |
+
def find_next_bar(escore_notes, bar_time, start_note_idx, cur_bar):
|
6533 |
+
for e in escore_notes[start_note_idx:]:
|
6534 |
+
if e[1] // bar_time > cur_bar:
|
6535 |
+
return e, escore_notes.index(e)
|
6536 |
+
|
6537 |
+
###################################################################################
|
6538 |
+
|
6539 |
+
def align_escore_notes_to_bars(escore_notes,
|
6540 |
+
bar_time=4000,
|
6541 |
+
trim_durations=False,
|
6542 |
+
split_durations=False
|
6543 |
+
):
|
6544 |
+
|
6545 |
+
#=============================================================================
|
6546 |
+
|
6547 |
+
aligned_escore_notes = copy.deepcopy(escore_notes)
|
6548 |
+
|
6549 |
+
abs_time = 0
|
6550 |
+
nidx = 0
|
6551 |
+
delta = 0
|
6552 |
+
bcount = 0
|
6553 |
+
next_bar = [0]
|
6554 |
+
|
6555 |
+
#=============================================================================
|
6556 |
+
|
6557 |
+
while next_bar:
|
6558 |
+
|
6559 |
+
next_bar = find_next_bar(escore_notes, bar_time, nidx, bcount)
|
6560 |
+
|
6561 |
+
if next_bar:
|
6562 |
+
|
6563 |
+
gescore_notes = escore_notes[nidx:next_bar[1]]
|
6564 |
+
else:
|
6565 |
+
gescore_notes = escore_notes[nidx:]
|
6566 |
+
|
6567 |
+
original_timings = [delta] + [(b[1]-a[1]) for a, b in zip(gescore_notes[:-1], gescore_notes[1:])]
|
6568 |
+
adj_timings = adjust_numbers_to_sum(original_timings, bar_time)
|
6569 |
+
|
6570 |
+
for t in adj_timings:
|
6571 |
+
|
6572 |
+
abs_time += t
|
6573 |
+
|
6574 |
+
aligned_escore_notes[nidx][1] = abs_time
|
6575 |
+
aligned_escore_notes[nidx][2] -= int(bar_time // 200)
|
6576 |
+
|
6577 |
+
nidx += 1
|
6578 |
+
|
6579 |
+
if next_bar:
|
6580 |
+
delta = escore_notes[next_bar[1]][1]-escore_notes[next_bar[1]-1][1]
|
6581 |
+
bcount += 1
|
6582 |
+
|
6583 |
+
#=============================================================================
|
6584 |
+
|
6585 |
+
aligned_adjusted_escore_notes = []
|
6586 |
+
bcount = 0
|
6587 |
+
|
6588 |
+
for a in aligned_escore_notes:
|
6589 |
+
bcount = a[1] // bar_time
|
6590 |
+
nbtime = bar_time * (bcount+1)
|
6591 |
+
|
6592 |
+
if a[1]+a[2] > nbtime and a[3] != 9:
|
6593 |
+
if trim_durations or split_durations:
|
6594 |
+
ddiff = ((a[1]+a[2])-nbtime)
|
6595 |
+
aa = copy.deepcopy(a)
|
6596 |
+
aa[2] = a[2] - ddiff
|
6597 |
+
aligned_adjusted_escore_notes.append(aa)
|
6598 |
+
|
6599 |
+
if split_durations:
|
6600 |
+
aaa = copy.deepcopy(a)
|
6601 |
+
aaa[1] = a[1]+aa[2]
|
6602 |
+
aaa[2] = ddiff
|
6603 |
+
|
6604 |
+
aligned_adjusted_escore_notes.append(aaa)
|
6605 |
+
|
6606 |
+
else:
|
6607 |
+
aligned_adjusted_escore_notes.append(a)
|
6608 |
+
|
6609 |
+
else:
|
6610 |
+
aligned_adjusted_escore_notes.append(a)
|
6611 |
+
|
6612 |
+
#=============================================================================
|
6613 |
+
|
6614 |
+
return aligned_adjusted_escore_notes
|
6615 |
+
|
6616 |
+
###################################################################################
|
6617 |
+
|
6618 |
+
def normalize_chord_durations(chord,
|
6619 |
+
dur_idx=2,
|
6620 |
+
norm_factor=100
|
6621 |
+
):
|
6622 |
+
|
6623 |
+
nchord = copy.deepcopy(chord)
|
6624 |
+
|
6625 |
+
for c in nchord:
|
6626 |
+
c[dur_idx] = int(round(max(1 / norm_factor, c[dur_idx] // norm_factor) * norm_factor))
|
6627 |
+
|
6628 |
+
return nchord
|
6629 |
+
|
6630 |
+
###################################################################################
|
6631 |
+
|
6632 |
+
def normalize_chordified_score_durations(chordified_score,
|
6633 |
+
dur_idx=2,
|
6634 |
+
norm_factor=100
|
6635 |
+
):
|
6636 |
+
|
6637 |
+
ncscore = copy.deepcopy(chordified_score)
|
6638 |
+
|
6639 |
+
for cc in ncscore:
|
6640 |
+
for c in cc:
|
6641 |
+
c[dur_idx] = int(round(max(1 / norm_factor, c[dur_idx] // norm_factor) * norm_factor))
|
6642 |
+
|
6643 |
+
return ncscore
|
6644 |
+
|
6645 |
+
###################################################################################
|
6646 |
+
|
6647 |
+
def horizontal_ordered_list_search(list_of_lists,
|
6648 |
+
query_list,
|
6649 |
+
start_idx=0,
|
6650 |
+
end_idx=-1
|
6651 |
+
):
|
6652 |
+
|
6653 |
+
lol = list_of_lists
|
6654 |
+
|
6655 |
+
results = []
|
6656 |
+
|
6657 |
+
if start_idx > 0:
|
6658 |
+
lol = list_of_lists[start_idx:]
|
6659 |
+
|
6660 |
+
if start_idx == -1:
|
6661 |
+
idx = -1
|
6662 |
+
for i, l in enumerate(list_of_lists):
|
6663 |
+
try:
|
6664 |
+
idx = l.index(query_list[0])
|
6665 |
+
lol = list_of_lists[i:]
|
6666 |
+
break
|
6667 |
+
except:
|
6668 |
+
continue
|
6669 |
+
|
6670 |
+
if idx == -1:
|
6671 |
+
results.append(-1)
|
6672 |
+
return results
|
6673 |
+
else:
|
6674 |
+
results.append(i)
|
6675 |
+
|
6676 |
+
if end_idx != -1:
|
6677 |
+
lol = list_of_lists[start_idx:start_idx+max(end_idx, len(query_list))]
|
6678 |
+
|
6679 |
+
for i, q in enumerate(query_list):
|
6680 |
+
try:
|
6681 |
+
idx = lol[i].index(q)
|
6682 |
+
results.append(idx)
|
6683 |
+
except:
|
6684 |
+
results.append(-1)
|
6685 |
+
return results
|
6686 |
+
|
6687 |
+
return results
|
6688 |
+
|
6689 |
+
###################################################################################
|
6690 |
+
|
6691 |
+
def escore_notes_to_escore_matrix(escore_notes,
|
6692 |
+
alt_velocities=False
|
6693 |
+
):
|
6694 |
+
|
6695 |
+
last_time = escore_notes[-1][1]
|
6696 |
+
last_notes = [e for e in escore_notes if e[1] == last_time]
|
6697 |
+
max_last_dur = max([e[2] for e in last_notes])
|
6698 |
+
|
6699 |
+
time_range = last_time+max_last_dur
|
6700 |
+
|
6701 |
+
channels_list = sorted(set([e[3] for e in escore_notes]))
|
6702 |
+
|
6703 |
+
escore_matrixes = []
|
6704 |
+
|
6705 |
+
for cha in channels_list:
|
6706 |
+
|
6707 |
+
escore_matrix = [[[-1, -1]] * 128 for _ in range(time_range)]
|
6708 |
+
|
6709 |
+
pe = escore_notes[0]
|
6710 |
+
|
6711 |
+
for i, note in enumerate(escore_notes):
|
6712 |
+
|
6713 |
+
etype, time, duration, channel, pitch, velocity, patch = note
|
6714 |
+
|
6715 |
+
time = max(0, time)
|
6716 |
+
duration = max(2, duration)
|
6717 |
+
channel = max(0, min(15, channel))
|
6718 |
+
pitch = max(0, min(127, pitch))
|
6719 |
+
velocity = max(0, min(127, velocity))
|
6720 |
+
patch = max(0, min(128, patch))
|
6721 |
+
|
6722 |
+
if alt_velocities:
|
6723 |
+
velocity -= (i % 2)
|
6724 |
+
|
6725 |
+
if channel == cha:
|
6726 |
+
|
6727 |
+
for t in range(time, min(time + duration, time_range)):
|
6728 |
+
|
6729 |
+
escore_matrix[t][pitch] = [velocity, patch]
|
6730 |
+
|
6731 |
+
pe = note
|
6732 |
+
|
6733 |
+
escore_matrixes.append(escore_matrix)
|
6734 |
+
|
6735 |
+
return [channels_list, escore_matrixes]
|
6736 |
+
|
6737 |
+
###################################################################################
|
6738 |
+
|
6739 |
+
def escore_matrix_to_merged_escore_notes(full_escore_matrix,
|
6740 |
+
max_note_duration=4000
|
6741 |
+
):
|
6742 |
+
|
6743 |
+
merged_escore_notes = []
|
6744 |
+
|
6745 |
+
mat_channels_list = full_escore_matrix[0]
|
6746 |
+
|
6747 |
+
for m, cha in enumerate(mat_channels_list):
|
6748 |
+
|
6749 |
+
escore_matrix = full_escore_matrix[1][m]
|
6750 |
+
|
6751 |
+
result = []
|
6752 |
+
|
6753 |
+
for j in range(len(escore_matrix[0])):
|
6754 |
+
|
6755 |
+
count = 1
|
6756 |
+
|
6757 |
+
for i in range(1, len(escore_matrix)):
|
6758 |
+
|
6759 |
+
if escore_matrix[i][j] != [-1, -1] and escore_matrix[i][j][1] == escore_matrix[i-1][j][1] and count < max_note_duration:
|
6760 |
+
count += 1
|
6761 |
+
|
6762 |
+
else:
|
6763 |
+
if count > 1:
|
6764 |
+
result.append([i-count, count, j, escore_matrix[i-1][j]])
|
6765 |
+
|
6766 |
+
count = 1
|
6767 |
+
|
6768 |
+
if count > 1:
|
6769 |
+
result.append([len(escore_matrix)-count, count, j, escore_matrix[-1][j]])
|
6770 |
+
|
6771 |
+
result.sort(key=lambda x: (x[0], -x[2]))
|
6772 |
+
|
6773 |
+
for r in result:
|
6774 |
+
merged_escore_notes.append(['note', r[0], r[1], cha, r[2], r[3][0], r[3][1]])
|
6775 |
+
|
6776 |
+
return sorted(merged_escore_notes, key=lambda x: (x[1], -x[4], x[6]))
|
6777 |
+
|
6778 |
+
###################################################################################
|
6779 |
+
|
6780 |
+
def escore_matrix_to_original_escore_notes(full_escore_matrix):
|
6781 |
+
|
6782 |
+
merged_escore_notes = []
|
6783 |
+
|
6784 |
+
mat_channels_list = full_escore_matrix[0]
|
6785 |
+
|
6786 |
+
for m, cha in enumerate(mat_channels_list):
|
6787 |
+
|
6788 |
+
escore_matrix = full_escore_matrix[1][m]
|
6789 |
+
|
6790 |
+
result = []
|
6791 |
+
|
6792 |
+
for j in range(len(escore_matrix[0])):
|
6793 |
+
|
6794 |
+
count = 1
|
6795 |
+
|
6796 |
+
for i in range(1, len(escore_matrix)):
|
6797 |
+
|
6798 |
+
if escore_matrix[i][j] != [-1, -1] and escore_matrix[i][j] == escore_matrix[i-1][j]:
|
6799 |
+
count += 1
|
6800 |
+
|
6801 |
+
else:
|
6802 |
+
if count > 1:
|
6803 |
+
result.append([i-count, count, j, escore_matrix[i-1][j]])
|
6804 |
+
|
6805 |
+
count = 1
|
6806 |
+
|
6807 |
+
if count > 1:
|
6808 |
+
result.append([len(escore_matrix)-count, count, j, escore_matrix[-1][j]])
|
6809 |
+
|
6810 |
+
result.sort(key=lambda x: (x[0], -x[2]))
|
6811 |
+
|
6812 |
+
for r in result:
|
6813 |
+
merged_escore_notes.append(['note', r[0], r[1], cha, r[2], r[3][0], r[3][1]])
|
6814 |
+
|
6815 |
+
return sorted(merged_escore_notes, key=lambda x: (x[1], -x[4], x[6]))
|
6816 |
+
|
6817 |
+
###################################################################################
|
6818 |
+
|
6819 |
+
def escore_notes_to_binary_matrix(escore_notes,
|
6820 |
+
channel=0,
|
6821 |
+
patch=0
|
6822 |
+
):
|
6823 |
+
|
6824 |
+
escore = [e for e in escore_notes if e[3] == channel and e[6] == patch]
|
6825 |
+
|
6826 |
+
if escore:
|
6827 |
+
last_time = escore[-1][1]
|
6828 |
+
last_notes = [e for e in escore if e[1] == last_time]
|
6829 |
+
max_last_dur = max([e[2] for e in last_notes])
|
6830 |
+
|
6831 |
+
time_range = last_time+max_last_dur
|
6832 |
+
|
6833 |
+
escore_matrix = []
|
6834 |
+
|
6835 |
+
escore_matrix = [[0] * 128 for _ in range(time_range)]
|
6836 |
+
|
6837 |
+
for note in escore:
|
6838 |
+
|
6839 |
+
etype, time, duration, chan, pitch, velocity, pat = note
|
6840 |
+
|
6841 |
+
time = max(0, time)
|
6842 |
+
duration = max(2, duration)
|
6843 |
+
chan = max(0, min(15, chan))
|
6844 |
+
pitch = max(0, min(127, pitch))
|
6845 |
+
velocity = max(0, min(127, velocity))
|
6846 |
+
pat = max(0, min(128, pat))
|
6847 |
+
|
6848 |
+
if channel == chan and patch == pat:
|
6849 |
+
|
6850 |
+
for t in range(time, min(time + duration, time_range)):
|
6851 |
+
|
6852 |
+
escore_matrix[t][pitch] = 1
|
6853 |
+
|
6854 |
+
return escore_matrix
|
6855 |
+
|
6856 |
+
else:
|
6857 |
+
return None
|
6858 |
+
|
6859 |
+
###################################################################################
|
6860 |
+
|
6861 |
+
def binary_matrix_to_original_escore_notes(binary_matrix,
|
6862 |
+
channel=0,
|
6863 |
+
patch=0,
|
6864 |
+
velocity=90
|
6865 |
+
):
|
6866 |
+
|
6867 |
+
result = []
|
6868 |
+
|
6869 |
+
for j in range(len(binary_matrix[0])):
|
6870 |
+
|
6871 |
+
count = 1
|
6872 |
+
|
6873 |
+
for i in range(1, len(binary_matrix)):
|
6874 |
+
|
6875 |
+
if binary_matrix[i][j] != 0 and binary_matrix[i][j] == binary_matrix[i-1][j]:
|
6876 |
+
count += 1
|
6877 |
+
|
6878 |
+
else:
|
6879 |
+
if count > 1:
|
6880 |
+
result.append([i-count, count, j, binary_matrix[i-1][j]])
|
6881 |
+
|
6882 |
+
count = 1
|
6883 |
+
|
6884 |
+
if count > 1:
|
6885 |
+
result.append([len(binary_matrix)-count, count, j, binary_matrix[-1][j]])
|
6886 |
+
|
6887 |
+
result.sort(key=lambda x: (x[0], -x[2]))
|
6888 |
+
|
6889 |
+
original_escore_notes = []
|
6890 |
+
|
6891 |
+
for r in result:
|
6892 |
+
original_escore_notes.append(['note', r[0], r[1], channel, r[2], velocity, patch])
|
6893 |
+
|
6894 |
+
return sorted(original_escore_notes, key=lambda x: (x[1], -x[4], x[6]))
|
6895 |
+
|
6896 |
+
###################################################################################
|
6897 |
+
|
6898 |
+
def escore_notes_averages(escore_notes,
|
6899 |
+
times_index=1,
|
6900 |
+
durs_index=2,
|
6901 |
+
chans_index=3,
|
6902 |
+
ptcs_index=4,
|
6903 |
+
vels_index=5,
|
6904 |
+
average_drums=False,
|
6905 |
+
score_is_delta=False,
|
6906 |
+
return_ptcs_and_vels=False
|
6907 |
+
):
|
6908 |
+
|
6909 |
+
if score_is_delta:
|
6910 |
+
if average_drums:
|
6911 |
+
times = [e[times_index] for e in escore_notes if e[times_index] != 0]
|
6912 |
+
else:
|
6913 |
+
times = [e[times_index] for e in escore_notes if e[times_index] != 0 and e[chans_index] != 9]
|
6914 |
+
|
6915 |
+
else:
|
6916 |
+
descore_notes = delta_score_notes(escore_notes)
|
6917 |
+
if average_drums:
|
6918 |
+
times = [e[times_index] for e in descore_notes if e[times_index] != 0]
|
6919 |
+
else:
|
6920 |
+
times = [e[times_index] for e in descore_notes if e[times_index] != 0 and e[chans_index] != 9]
|
6921 |
+
|
6922 |
+
if average_drums:
|
6923 |
+
durs = [e[durs_index] for e in escore_notes]
|
6924 |
+
else:
|
6925 |
+
durs = [e[durs_index] for e in escore_notes if e[chans_index] != 9]
|
6926 |
+
|
6927 |
+
if return_ptcs_and_vels:
|
6928 |
+
if average_drums:
|
6929 |
+
ptcs = [e[ptcs_index] for e in escore_notes]
|
6930 |
+
vels = [e[vels_index] for e in escore_notes]
|
6931 |
+
else:
|
6932 |
+
ptcs = [e[ptcs_index] for e in escore_notes if e[chans_index] != 9]
|
6933 |
+
vels = [e[vels_index] for e in escore_notes if e[chans_index] != 9]
|
6934 |
+
|
6935 |
+
return [sum(times) / len(times), sum(durs) / len(durs), sum(ptcs) / len(ptcs), sum(vels) / len(vels)]
|
6936 |
+
|
6937 |
+
else:
|
6938 |
+
return [sum(times) / len(times), sum(durs) / len(durs)]
|
6939 |
+
|
6940 |
+
###################################################################################
|
6941 |
+
|
6942 |
+
def adjust_escore_notes_timings(escore_notes,
|
6943 |
+
adj_k=1,
|
6944 |
+
times_index=1,
|
6945 |
+
durs_index=2,
|
6946 |
+
score_is_delta=False,
|
6947 |
+
return_delta_scpre=False
|
6948 |
+
):
|
6949 |
+
|
6950 |
+
if score_is_delta:
|
6951 |
+
adj_escore_notes = copy.deepcopy(escore_notes)
|
6952 |
+
else:
|
6953 |
+
adj_escore_notes = delta_score_notes(escore_notes)
|
6954 |
+
|
6955 |
+
for e in adj_escore_notes:
|
6956 |
+
|
6957 |
+
if e[times_index] != 0:
|
6958 |
+
e[times_index] = max(1, round(e[times_index] * adj_k))
|
6959 |
+
|
6960 |
+
e[durs_index] = max(1, round(e[durs_index] * adj_k))
|
6961 |
+
|
6962 |
+
if return_delta_scpre:
|
6963 |
+
return adj_escore_notes
|
6964 |
+
|
6965 |
+
else:
|
6966 |
+
return delta_score_to_abs_score(adj_escore_notes)
|
6967 |
+
|
6968 |
+
###################################################################################
|
6969 |
+
|
6970 |
+
def escore_notes_delta_times(escore_notes,
|
6971 |
+
times_index=1
|
6972 |
+
):
|
6973 |
+
|
6974 |
+
descore_notes = delta_score_notes(escore_notes)
|
6975 |
+
|
6976 |
+
return [e[times_index] for e in descore_notes]
|
6977 |
+
|
6978 |
+
###################################################################################
|
6979 |
+
|
6980 |
+
def escore_notes_durations(escore_notes,
|
6981 |
+
durs_index=1
|
6982 |
+
):
|
6983 |
+
|
6984 |
+
descore_notes = delta_score_notes(escore_notes)
|
6985 |
+
|
6986 |
+
return [e[durs_index] for e in descore_notes]
|
6987 |
+
|
6988 |
+
###################################################################################
|
6989 |
+
|
6990 |
+
def ordered_lists_match_ratio(src_list, trg_list):
|
6991 |
+
|
6992 |
+
zlist = list(zip(src_list, trg_list))
|
6993 |
+
|
6994 |
+
return sum([a == b for a, b in zlist]) / len(list(zlist))
|
6995 |
+
|
6996 |
+
###################################################################################
|
6997 |
+
|
6998 |
+
def lists_intersections(src_list, trg_list):
|
6999 |
+
return list(set(src_list) & set(trg_list))
|
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 |
###################################################################################
|