File size: 3,974 Bytes
2ec0615
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d08186b
2ec0615
d08186b
2ec0615
 
 
d08186b
2ec0615
d08186b
 
 
 
 
 
 
2ec0615
 
 
d08186b
2ec0615
d08186b
2ec0615
 
 
d08186b
2ec0615
d08186b
2ec0615
 
 
d08186b
2ec0615
d08186b
2ec0615
 
 
d08186b
2ec0615
d08186b
2ec0615
 
 
d08186b
2ec0615
d08186b
 
 
 
 
 
 
 
 
 
 
 
 
2ec0615
 
 
 
 
d08186b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ec0615
 
 
 
 
d08186b
2ec0615
 
6445b7a
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# fmt: off
# Instrument mapping and mapping functions
INSTRUMENT_CLASSES = [
    {"name": "Piano", "program_range": range(0, 8), "family_number": 0},
    {"name": "Chromatic Percussion", "program_range": range(8, 16), "family_number": 1},
    {"name": "Organ", "program_range": range(16, 24), "family_number": 2},
    {"name": "Guitar", "program_range": range(24, 32), "family_number": 3},
    {"name": "Bass", "program_range": range(32, 40), "family_number": 4},
    {"name": "Strings", "program_range": range(40, 48), "family_number": 5},
    {"name": "Ensemble", "program_range": range(48, 56), "family_number": 6},
    {"name": "Brass", "program_range": range(56, 64), "family_number": 7},
    {"name": "Reed", "program_range": range(64, 72), "family_number": 8},
    {"name": "Pipe", "program_range": range(72, 80), "family_number": 9},
    {"name": "Synth Lead", "program_range": range(80, 88), "family_number": 10},
    {"name": "Synth Pad", "program_range": range(88, 96), "family_number": 11},
    {"name": "Synth Effects", "program_range": range(96, 104), "family_number": 12},
    {"name": "Ethnic", "program_range": range(104, 112), "family_number": 13},
    {"name": "Percussive", "program_range": range(112, 120), "family_number": 14},
    {"name": "Sound Effects", "program_range": range(120, 128), "family_number": 15,},
]
# fmt: on

# Instrument mapping for decodiing our midi sequence into midi instruments of our choice
INSTRUMENT_TRANSFER_CLASSES = [
    {
        "name": "Piano",
        "program_range": [4],
        "family_number": 0,
        "transfer_to": "Electric Piano 1",
    },
    {
        "name": "Chromatic Percussion",
        "program_range": [11],
        "family_number": 1,
        "transfer_to": "Vibraphone",
    },
    {
        "name": "Organ",
        "program_range": [17],
        "family_number": 2,
        "transfer_to": "Percussive Organ",
    },
    {
        "name": "Guitar",
        "program_range": [80],
        "family_number": 3,
        "transfer_to": "Synth Lead Square",
    },
    {
        "name": "Bass",
        "program_range": [38],
        "family_number": 4,
        "transfer_to": "Synth Bass 1",
    },
    {
        "name": "Strings",
        "program_range": [50],
        "family_number": 5,
        "transfer_to": "Synth Strings 1",
    },
    {
        "name": "Ensemble",
        "program_range": [51],
        "family_number": 6,
        "transfer_to": "Synth Strings 2",
    },
    {
        "name": "Brass",
        "program_range": [63],
        "family_number": 7,
        "transfer_to": "Synth Brass 1",
    },
    {
        "name": "Reed",
        "program_range": [64],
        "family_number": 8,
        "transfer_to": "Synth Brass 2",
    },
    {
        "name": "Pipe",
        "program_range": [82],
        "family_number": 9,
        "transfer_to": "Synth Lead Calliope",
    },
    {
        "name": "Synth Lead",
        "program_range": [81],  # Synth Lead Sawtooth
        "family_number": 10,
        "transfer_to": "Synth Lead Sawtooth",
    },
    {
        "name": "Synth Pad",
        "program_range": range(88, 96),
        "family_number": 11,
        "transfer_to": "Synth Pad",
    },
    {
        "name": "Synth Effects",
        "program_range": range(96, 104),
        "family_number": 12,
        "transfer_to": "Synth Effects",
    },
    {
        "name": "Ethnic",
        "program_range": range(104, 112),
        "family_number": 13,
        "transfer_to": "Ethnic",
    },
    {
        "name": "Percussive",
        "program_range": range(112, 120),
        "family_number": 14,
        "transfer_to": "Percussive",
    },
    {
        "name": "Sound Effects",
        "program_range": range(120, 128),
        "family_number": 15,
        "transfer_to": "Sound Effects",
    },
]


"Encoding and decoding constants"

DRUMS_BEAT_QUANTIZATION = 4  # 8th notes per beat
NONE_DRUMS_BEAT_QUANTIZATION = 4  # 4th notes per beat
BEATS_PER_BAR = 4  # 4/4 time