-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchimes_note_constants.nxc
127 lines (114 loc) · 4.12 KB
/
chimes_note_constants.nxc
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
// Angles of the left and right side mallet notes
const int NOTE_ANGLES_LEFT[] = { -180,
-31,-51,-74,-97,-122,-146,-170,-197,-222,-246,-271,-292,-315 };
const int NOTE_ANGLES_RIGHT[] = { 190,
41, 62, 86,111, 135, 159, 184, 210, 236, 260, 284, 303, 328 };
// Wiggle room of the mallet when switching direction
const int BACKLASH_ANGLE = 5;
// Bit masks to extract note details from constants
const byte NOTE_SIDE_MASK = 0xF0;
const byte NOTE_INDEX_MASK = 0x0F;
// Notes of the left side mallet
const byte NOTE_LEFT = 0xA0;
const byte NOTE_L_NONE = 0xA0;
const byte NOTE_L_A0 = 0xA1;
const byte NOTE_L_C2 = 0xA2;
const byte NOTE_L_B1 = 0xA3;
const byte NOTE_L_AS1 = 0xA4;
const byte NOTE_L_A1 = 0xA5;
const byte NOTE_L_GS1 = 0xA6;
const byte NOTE_L_G1 = 0xA7;
const byte NOTE_L_FS1 = 0xA8;
const byte NOTE_L_F1 = 0xA9;
const byte NOTE_L_E1 = 0xAA;
const byte NOTE_L_DS1 = 0xAB;
const byte NOTE_L_D1 = 0xAC;
const byte NOTE_L_CS1 = 0xAD;
const byte NOTES_LEFT[] = {
NOTE_L_A0, NOTE_L_C2, NOTE_L_B1, NOTE_L_AS1, NOTE_L_A1,
NOTE_L_GS1, NOTE_L_G1, NOTE_L_FS1, NOTE_L_F1, NOTE_L_E1,
NOTE_L_DS1, NOTE_L_D1, NOTE_L_CS1 };
// Notes of the right side mallet
const byte NOTE_RIGHT = 0xB0;
const byte NOTE_R_NONE = 0xB0;
const byte NOTE_R_F1 = 0xB1;
const byte NOTE_R_E1 = 0xB2;
const byte NOTE_R_DS1 = 0xB3;
const byte NOTE_R_D1 = 0xB4;
const byte NOTE_R_CS1 = 0xB5;
const byte NOTE_R_C1 = 0xB6;
const byte NOTE_R_B0 = 0xB7;
const byte NOTE_R_AS0 = 0xB8;
const byte NOTE_R_A0 = 0xB9;
const byte NOTE_R_C2 = 0xBA;
const byte NOTE_R_B1 = 0xBB;
const byte NOTE_R_AS1 = 0xBC;
const byte NOTE_R_A1 = 0xBD;
// Note details
const byte NOTE_TEMPO = 0xC1;
const byte NOTES_RIGHT[] = {
NOTE_R_F1, NOTE_R_E1, NOTE_R_DS1, NOTE_R_D1, NOTE_R_CS1,
NOTE_R_C1, NOTE_R_B0, NOTE_R_AS0, NOTE_R_A0, NOTE_R_C2,
NOTE_R_B1, NOTE_R_AS1, NOTE_R_A1 };
// Accords
const byte ACCORDS[][] = {
// DUR
{NOTE_R_C1, NOTE_L_E1, NOTE_L_G1}, // C
{NOTE_L_G1, NOTE_R_B1, NOTE_L_D1}, // G
{NOTE_R_D1, NOTE_L_FS1, NOTE_L_A1}, // D
{NOTE_L_A1, NOTE_R_CS1, NOTE_L_E1}, // A
{NOTE_L_E1, NOTE_L_GS1, NOTE_R_B1}, // E
{NOTE_R_B1, NOTE_L_DS1, NOTE_L_FS1}, // H
{NOTE_L_FS1, NOTE_L_AS1, NOTE_R_CS1}, // Fis
// {NOTE_L_FS1, NOTE_L_AS1, NOTE_R_CS1}, // Ges
{NOTE_R_CS1, NOTE_L_F1, NOTE_L_GS1}, // Des
{NOTE_L_GS1, NOTE_R_C1, NOTE_L_DS1}, // As
{NOTE_L_DS1, NOTE_L_G1, NOTE_L_AS1}, // Es
{NOTE_L_AS1, NOTE_R_D1, NOTE_L_F1}, // B
{NOTE_L_F1, NOTE_L_A1, NOTE_R_C2}, // F
//MOL
{NOTE_L_A1, NOTE_R_C1, NOTE_L_E1}, // A
{NOTE_L_E1, NOTE_L_G1, NOTE_R_B1}, // E
{NOTE_R_B1, NOTE_R_D1, NOTE_L_FS1}, // H
{NOTE_L_FS1, NOTE_L_A1, NOTE_R_CS1}, // Fis
{NOTE_R_CS1, NOTE_L_E1, NOTE_L_GS1}, // Cis
{NOTE_L_DS1, NOTE_L_FS1, NOTE_L_AS1}, // Dis
// {NOTE_L_DS1, NOTE_L_FS1, NOTE_L_AS1}, // Es
{NOTE_L_AS1, NOTE_R_CS1, NOTE_L_F1}, // B
{NOTE_L_F1, NOTE_L_GS1, NOTE_R_C1}, // F
{NOTE_R_C1, NOTE_L_DS1, NOTE_L_G1}, // C
{NOTE_L_G1, NOTE_L_AS1, NOTE_R_D1}, // G
{NOTE_R_D1, NOTE_L_F1, NOTE_L_A1}, // D
{NOTE_L_A1, NOTE_R_C1, NOTE_L_E1}, // A
};
// Hitting the notes with the mallet
const byte HIT_NONE = 0x00;
const byte HIT_LEFT = 0x01;
const byte HIT_RIGHT = 0x02;
const byte HIT_BOTH = 0x03;
const byte HIT_MS_32TH = 0xA0;
// Pauses in the music
const byte PAUSE_NONE = 0x00;
const byte PAUSE_FULL = 0x40;
const byte PAUSE_HALF_DOTTED = 0x30;
const byte PAUSE_HALF = 0x20;
const byte PAUSE_04TH_DOTTED = 0x18;
const byte PAUSE_04TH = 0x10;
const byte PAUSE_08TH_TRIOL1 = 0x05;
const byte PAUSE_08TH_TRIOL2 = 0x05;
const byte PAUSE_08TH_TRIOL3 = 0x06;
const byte PAUSE_08TH_DOTTED = 0x0C;
const byte PAUSE_08TH = 0x08;
const byte PAUSE_16TH = 0x04;
const byte PAUSE_32TH = 0x02;
const byte PAUSE_64TH = 0x01;
// Indices in a music array
const byte INDEX_OF_NOTE = 0;
const byte INDEX_OF_HIT = 1;
const byte INDEX_OF_PAUSE = 2;
// File structure of a song
struct file_step {
byte note;
byte hit;
byte pause;
};