summaryrefslogtreecommitdiffstats
path: root/Processing/Synthe3000/Config.pde
blob: c3638b3f1fac9b43932c21e9d65835e201945b73 (plain)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* Configuration de la partition */
int[][] notes = {
  /* Première ligne */
  {
    8, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    10, 1, 2
  }
  , {
    9, 1, 2
  }
  , {
    8, 1, 1
  }
  , {
    10, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    8, 1, 4
  },
/* Deuxième ligne */
  {
    8, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    10, 1, 2
  }
  , {
    9, 1, 2
  }
  , {
    8, 1, 1
  }
  , {
    10, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    8, 1, 4
  },
/* Troisième ligne */
  {
    9, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    6, 1, 2
  }
  , {
    6, 1, 2
  }
  , {
    9, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    7, 1, 1
  }
  , {
    6, 1, 1
  }
  , {
    5, 1, 4
  },
/* Quatrième ligne */
  {
    8, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    8, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    10, 1, 2
  }
  , {
    9, 1, 2
  }
  , {
    8, 1, 1
  }
  , {
    10, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    9, 1, 1
  }
  , {
    8, 1, 4
  }
}; // Tableau de tableaux d'entiers pour les notes
// notes[numnote][0] est la note à jouer, notes[numnote][1] est la durée de la note
int bpm = 115; // tempo
int timer = 0; // Initialisation du chronomètre à 0
int numnote = 0; // La première note à jouer a l'indice 0
String imagePartition = "PartitionLune.png";

/* Configuraton du synthétiseur */
int midiChannelNumber = 1; // Monotimbral, utilisation du 1er canal uniquement.
int midiVelocity = 127; // Force de la note, de 0 à 127
int baseNote = 72; // Note de base à partir de laquelle les autres seront calculées. 72 : Do4
MidiChannel channel;


/* Configuration de l'affichage */
float buttonRadius = 0.025; // Rayon du cercle des boutons
String font = "CurlzMT-48.vlw"; // Fichier de la police
int tailleTexte = 30;
int[] windowSize = {1130, 650}; // Largeur et hauteur de la fenêtre
float[] keyWidth = {0.070, 0.144}; // Largeur touche noire et touche blanche
float[] keyHeight = {0.358, 0.538}; // Hauteur touche noire et touche blanche
float[] imageSize = {0.633, 0.461}; // Largeur et hauteur de la partition
float[] imageCoordinates = {0.183, 0}; // Coordonnées x et y de la partition
float[] keyXCoordinates = {0.096, 0.262, 0.518, 0.678, 0.838}; // Placement horizontal des touches noires sur une octave
float keyboardYCoordinate = 0.462; // Placement vertical du clavier
int numOctaves = 2; // Nombre d'octave à afficher
String[] nomTouchesBlanches = {"Tab", "A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", "^", "$", "Enter"};
String[] nomTouchesNoires = {"&", "é", "'", "(", "-", "_", "ç", ")", "=", "<-"};
float[] playButtonCoordinates = {0.90, 0.10};
float[] recordButtonCoordinates = {0.90, 0.20};


/* Déclaration et initialisation de diverses constantes et variables */

/* Gestion des évènements */
final int MOUSEPRESSED = 0;
final int KEYPRESSED = 1;
final int PLAYPRESSED = 2;
final int MUSICSTARTED = 3;
final int MUSICFINISHED = 4;
final int RECORDINGSTARTED = 5;
final int RECORDINGSTOPPED = 6;
final int MUSICPLAYED = 7;
boolean[] events = new boolean[8];

/* Stockages des touches cliquées */
int[][] notePressed = new int[512][2]; // Un maximum de 512 notes peuvent être enregistrées
int[][] keysPressed = {new int[numOctaves*5], new int[numOctaves*7]};   // Tableau des touches cliquées. keysPressed[0] pour les touches noires et keysPressed[1] pour les blanches
int[][] tmpNotes = new int[notes.length][2]; // Stockage du timestamp des notes de la partition


int score = -1;
PImage PartitionLune;


int[] touchesNoires = new int[523];
int[] touchesBlanches = new int[523];

/* Associations des touches du clavier aux notes */
void defineKeys()
{
  // Touches blanches
  touchesBlanches[9] = 1;
  touchesBlanches[65] = 2;
  touchesBlanches[90] = 3;
  touchesBlanches[69] = 4;
  touchesBlanches[82] = 5;
  touchesBlanches[84] = 6;
  touchesBlanches[89] = 7;
  touchesBlanches[85] = 8;
  touchesBlanches[73] = 9;
  touchesBlanches[79] = 10;
  touchesBlanches[80] = 11;
  touchesBlanches[130] = 12;
  touchesBlanches[514] = 12;
  touchesBlanches[160] = 12;
  touchesBlanches[515] = 13;
  touchesBlanches[164] = 13;
  touchesBlanches[10] = 14;

  // Touches noires
  touchesNoires[49] = 1;
  touchesNoires[50] = 2;
  touchesNoires[52] = 3;
  touchesNoires[53] = 4;
  touchesNoires[54] = 5;
  touchesNoires[56] = 6;
  touchesNoires[57] = 7;
  touchesNoires[522] = 8;
  touchesNoires[169] = 8;
  touchesNoires[61] = 9;
  touchesNoires[8] = 10;
}