Mercurial > hg > movesynth
comparison HeresyBigBangDone/application.macosx/source/HeresyAl.pde @ 50:f4c6999ecfe9 tip
added the files on my computer that aren't aiff s> these shoudl be everything for the big bang fair 2011 - heresy, and tim's file's also here
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Sat, 08 Oct 2011 22:12:49 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
49:0eeda0223db3 | 50:f4c6999ecfe9 |
---|---|
1 boolean heresyMinor, oldHeresyMinor, heresy7th, oldHeresy7th, heresy9th, oldHeresy9th, heresy11th, oldHeresy11th, heresy13th, oldHeresy13th, heresyDom; | |
2 boolean heresyMinorChanged, heresyChordChanged, heresy7thChanged, heresy9thChanged, heresy11thChanged, heresy13thChanged, heresyChange, dontRevoice; | |
3 int currentChord, lastChord; | |
4 VPArray[] VPA = new VPArray[16]; | |
5 int[] notesOnArray = new int[16]; | |
6 int no1s = 0; int no3s = 0; int no5s = 0; int no7s = 0; int no9s = 0; int no11s = 0; int no13s = 0; | |
7 int tonic = 0; | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 //------------------------------------------------------------------------------------------------------------------------------- | |
14 | |
15 /* public int getHeresyPitch(int extension, int notePosition){ // delivers heresy pitches | |
16 int value = getExtentionPitch(extension) % 12; | |
17 if (notePosition == 15) value += 24; | |
18 if (notePosition == 14) value += 36; | |
19 if (notePosition == 13) value += 36; | |
20 if (notePosition == 12) value += 48; | |
21 if (notePosition == 11) value += 48; | |
22 if (notePosition == 10) value += 48; | |
23 if (notePosition == 9) value += 48; | |
24 if (notePosition == 8) value += 60; | |
25 if (notePosition == 7) value += 60; | |
26 if (notePosition == 6) value += 60; | |
27 if (notePosition == 5) value += 60; | |
28 if (notePosition == 4) value += 72; | |
29 if (notePosition == 3) value += 72; | |
30 if (notePosition == 2) value += 72; | |
31 if (notePosition == 1) value += 72; | |
32 if (notePosition == 0) value += 84; | |
33 return value; | |
34 }*/ | |
35 | |
36 | |
37 public int heresyPitchInfo(int arrayPosition){ // returns a value for checking if note required is currently playing | |
38 int value = 0; | |
39 if (heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){ | |
40 if (arrayPosition == 15) value = (15-currentChord) + 24; | |
41 if (arrayPosition == 14) value = (15-currentChord) + 36; | |
42 if (arrayPosition == 13) value = (15-currentChord) + 43; | |
43 if (arrayPosition == 12) value = (15-currentChord) + 50; | |
44 if (arrayPosition == 11) value = (15-currentChord) + 51; | |
45 if (arrayPosition == 10) value = (15-currentChord) + 58; | |
46 if (arrayPosition == 9) value = (15-currentChord) + 65; | |
47 if (arrayPosition == 8) value = (15-currentChord) + 67; | |
48 if (arrayPosition == 7) value = (15-currentChord) + 70; | |
49 if (arrayPosition == 6) value = (15-currentChord) + 72; | |
50 if (arrayPosition == 5) value = (15-currentChord) + 74; | |
51 if (arrayPosition == 4) value = (15-currentChord) + 75; | |
52 if (arrayPosition == 3) value = (15-currentChord) + 77; | |
53 if (arrayPosition == 2) value = (15-currentChord) + 79; | |
54 if (arrayPosition == 1) value = (15-currentChord) + 82; | |
55 if (arrayPosition == 0) value = (15-currentChord) + 84; | |
56 } | |
57 if (!heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){ | |
58 if (arrayPosition == 15) value = (15-currentChord) + 24; | |
59 if (arrayPosition == 14) value = (15-currentChord) + 36; | |
60 if (arrayPosition == 13) value = (15-currentChord) + 43; | |
61 if (arrayPosition == 12) value = (15-currentChord) + 50; | |
62 if (arrayPosition == 11) value = (15-currentChord) + 52; | |
63 if (arrayPosition == 10) value = (15-currentChord) + 59; | |
64 if (arrayPosition == 9) value = (15-currentChord) + 66; | |
65 if (arrayPosition == 8) value = (15-currentChord) + 71; | |
66 if (arrayPosition == 7) value = (15-currentChord) + 74; | |
67 if (arrayPosition == 6) value = (15-currentChord) + 78; | |
68 if (arrayPosition == 5) value = (15-currentChord) + 83; | |
69 if (arrayPosition == 4) value = (15-currentChord) + 75; | |
70 if (arrayPosition == 3) value = (15-currentChord) + 77; | |
71 if (arrayPosition == 2) value = (15-currentChord) + 79; | |
72 if (arrayPosition == 1) value = (15-currentChord) + 82; | |
73 if (arrayPosition == 0) value = (15-currentChord) + 84; | |
74 } | |
75 return value; | |
76 } | |
77 | |
78 | |
79 //------------------------------------------------------------------------------------------------------------------------------- | |
80 | |
81 public void playTrackEvents(){ // initiates the playing Heresy AI logic | |
82 | |
83 workOutExtensions(); | |
84 //workOutChord(); | |
85 heresyChangeHistory(); | |
86 VpaNoteStater(); | |
87 // heresyVoicingArray(); | |
88 countNoteOns(); | |
89 | |
90 | |
91 } | |
92 | |
93 | |
94 //------------------------------------------------------------------------------------------------------------------------------- | |
95 | |
96 public void sendNoteEvents(){ // sends sequencer evernts to the IO section for out put to max | |
97 for(int i = 1; i < Track.currentNumberOfTracks; i++){ | |
98 if (tracks[i] != null ){ | |
99 for (int ii = 0; ii < 16; ii++) { | |
100 if (!VPA[i].VPArrayNotes[ii].played){ | |
101 outputToMax (VPA[i].VPArrayNotes[ii].VPNotePitch, VPA[i].VPArrayNotes[ii].VPNoteVelocity, i); | |
102 VPA[i].VPArrayNotes[ii].played = true; | |
103 } | |
104 } | |
105 } | |
106 } | |
107 } | |
108 | |
109 | |
110 //------------------------------------------------------------------------------------------------------------------------------- | |
111 | |
112 public void VpaNoteStater(){ // calculates pitches based on Heresy AI voice leading and voicing tables. | |
113 for(int i = 1; i < Track.currentNumberOfTracks; i++){ | |
114 if (tracks[i] != null){ | |
115 for (int ii = 0; ii < 16; ii++) { | |
116 if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)] != null){ | |
117 if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity != 0){ | |
118 if (VPA[i].VPArrayNotes[ii].VPNoteOn && heresyPitchInfo(ii) != VPA[i].VPArrayNotes[ii].VPNotePitch){ | |
119 // println("in..."); | |
120 VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0; | |
121 sendNote(VPA[i].VPArrayNotes[ii], i); | |
122 if (i != 1 && i != 5) | |
123 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3); | |
124 else | |
125 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1); | |
126 VPA[i].VPArrayNotes[ii].VPNoteVelocity = tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity; | |
127 sendNote(VPA[i].VPArrayNotes[ii], i); | |
128 }else{ | |
129 // println("in2..."); | |
130 if (i != 1 && i != 5) | |
131 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3); | |
132 else | |
133 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1); | |
134 VPA[i].VPArrayNotes[ii].VPNoteVelocity = tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity; | |
135 sendNote(VPA[i].VPArrayNotes[ii], i); | |
136 } | |
137 } | |
138 if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity == 0){ | |
139 VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0; | |
140 sendNote(VPA[i].VPArrayNotes[ii], i); | |
141 } | |
142 } | |
143 } | |
144 } | |
145 } | |
146 } | |
147 | |
148 | |
149 //------------------------------------------------------------------------------------------------------------------------------- | |
150 | |
151 /* public void heresyVoicingArray(){ // sets the voicing array to be used for note ons | |
152 if (!heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice135; | |
153 if (heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice7; | |
154 if (!heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice9; | |
155 if (!heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice11; | |
156 if (!heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice13; | |
157 if (heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice79; | |
158 if (heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice711; | |
159 if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice713; | |
160 if (!heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice911; | |
161 if (!heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice913; | |
162 if (!heresy7th && !heresy9th && heresy11th && heresy13th) hvArray = hchoice1113; | |
163 if (heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice7911; | |
164 if (heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice7913; | |
165 if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice71113; | |
166 if (!heresy7th && heresy9th && heresy11th && heresy13th) hvArray = hchoice91113; | |
167 } | |
168 | |
169 */ | |
170 | |
171 | |
172 //------------------------------------------------------------------------------------------------------------------------------- | |
173 | |
174 public void countNoteOns(){ // counts the note ons for all tracks | |
175 for (int ii = 0; ii < 16; ii++){ | |
176 notesOnArray[ii] = 0;} | |
177 for(int i = 1; i < Track.currentNumberOfTracks; i++){ | |
178 for (int ii = 0; ii < 16; ii++){ | |
179 if (VPA[i].VPArrayNotes[ii].VPNoteOn == true) | |
180 notesOnArray[i]++; | |
181 } | |
182 } | |
183 } | |
184 | |
185 | |
186 //------------------------------------------------------------------------------------------------------------------------------- | |
187 | |
188 /* public void calculateHeresyNoteExtensions(){ | |
189 for(int tracki = 1; tracki < Track.currentNumberOfTracks; tracki++){ | |
190 no1s = 0; no3s = 0; no5s = 0; no7s = 0; no9s = 0; no11s = 0; no13s = 0; | |
191 | |
192 checkIfNotesAlreadyFit(tracki); | |
193 | |
194 calcRemainingNotes(tracki); | |
195 | |
196 for (int t = 0; t < 16; t++){ | |
197 VPA[tracki].VPArrayNotes[t].done = false; | |
198 } | |
199 } | |
200 } | |
201 | |
202 */ | |
203 | |
204 | |
205 //------------------------------------------------------------------------------------------------------------------------------- | |
206 | |
207 /* public void calcRemainingNotes(int tracki){ | |
208 int counter = -1; | |
209 int looped = 0; | |
210 while (no1s + no3s + no5s + no7s + no9s + no11s + no13s != 0){ | |
211 counter++; | |
212 if (counter >= notesOnArray[tracki]){ | |
213 counter = 0; | |
214 looped++; | |
215 } | |
216 int nextExtension = hvArray[counter]; | |
217 if(extensionNeeded(nextExtension)){ | |
218 for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ | |
219 if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){ | |
220 if (extensionPossible(playingNotesi, nextExtension)){ | |
221 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = getHeresyPitch(nextExtension, playingNotesi); | |
222 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
223 println("got pitch " + VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch); | |
224 // correctIfNeeded(tracki, playingNotesi, nextExtension); | |
225 }else println("wasn't possible"); | |
226 } | |
227 } | |
228 } | |
229 if (looped > 3) { | |
230 for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ | |
231 if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){ | |
232 VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn = false; | |
233 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -1; | |
234 } | |
235 } | |
236 System.out.println("Had to break_________________"); | |
237 break; | |
238 } | |
239 } | |
240 } | |
241 | |
242 */ | |
243 | |
244 | |
245 //------------------------------------------------------------------------------------------------------------------------------- | |
246 | |
247 /* public void correctIfNeeded(int tracki, int playingNotesi, int nextExtension){ // changes note pitch of a virtual note on to a different octave in needed for voice leading | |
248 boolean alreadyGotNote = false; boolean alreadyGotNotePlus12 = false; boolean alreadyGotNoteMinus12 = false; | |
249 int pitchAverage = 0; | |
250 for (int i = 0; i < 16; i++) | |
251 if (i != playingNotesi){ | |
252 if (VPA[tracki].VPArrayNotes[i].done) | |
253 pitchAverage += VPA[tracki].VPArrayNotes[i].VPNotePitch; | |
254 if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch) | |
255 alreadyGotNote = true; | |
256 if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12) | |
257 alreadyGotNotePlus12 = true; | |
258 if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12) | |
259 alreadyGotNoteMinus12 = true; | |
260 } | |
261 if (notesOnArray[tracki]-1 > 0) | |
262 pitchAverage = pitchAverage / (notesOnArray[tracki]-1); | |
263 else | |
264 pitchAverage = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch; | |
265 boolean correctedIt = false; | |
266 if (alreadyGotNote){ | |
267 println("correcting note.........."); | |
268 if (!alreadyGotNotePlus12 && pitchAverage > VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){ | |
269 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12; | |
270 correctedIt = true; | |
271 }else | |
272 if (!alreadyGotNoteMinus12){ | |
273 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12; | |
274 correctedIt = true; | |
275 } | |
276 if (!alreadyGotNoteMinus12 && pitchAverage < VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){ | |
277 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12; | |
278 correctedIt = true; | |
279 }else | |
280 if (!alreadyGotNotePlus12){ | |
281 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12; | |
282 correctedIt = true; | |
283 } | |
284 } | |
285 if (alreadyGotNote && !correctedIt) | |
286 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -2; | |
287 if (!alreadyGotNote || correctedIt){ | |
288 VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80; | |
289 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
290 VPA[tracki].VPArrayNotes[playingNotesi].played = false; | |
291 extensionCounter(false, nextExtension); | |
292 }else{ | |
293 VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80; | |
294 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
295 } | |
296 } | |
297 | |
298 */ | |
299 | |
300 | |
301 //------------------------------------------------------------------------------------------------------------------------------- | |
302 | |
303 | |
304 | |
305 /* public void checkIfNotesAlreadyFit(int tracki){ | |
306 for (int extensioni = 0; extensioni < notesOnArray[tracki]; extensioni++){ | |
307 boolean extensionFound = false; | |
308 for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ | |
309 if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn && !VPA[tracki].VPArrayNotes[playingNotesi].done && !extensionFound && VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch >= 24){ | |
310 if (disiredPitch(VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch, hvArray[extensioni])){ | |
311 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
312 extensionFound = true; | |
313 } | |
314 } | |
315 } | |
316 if (!extensionFound){ | |
317 extensionCounter(true, hvArray[extensioni]); | |
318 } | |
319 } | |
320 } | |
321 | |
322 */ | |
323 | |
324 | |
325 //------------------------------------------------------------------------------------------------------------------------------- | |
326 | |
327 /* public boolean pitchInChord(int currentPitch){ | |
328 boolean returnValue = false; | |
329 for (int i = 0; i < 16; i++){ | |
330 // println("currentPitch " + currentPitch + " getHeresyPitch(hvArray[i], 5) % 12) " + (getHeresyPitch(hvArray[i], 5))); | |
331 if (currentPitch % 12 == (getHeresyPitch(hvArray[i], 5) % 12)); | |
332 returnValue = true; | |
333 } | |
334 return returnValue; | |
335 } | |
336 */ | |
337 | |
338 //------------------------------------------------------------------------------------------------------------------------------- | |
339 | |
340 /* public boolean extensionNeeded(int extension){ | |
341 boolean needed = false; | |
342 if (extension == 1 && no1s > 0) needed = true; | |
343 if (extension == 3 && no3s > 0) needed = true; | |
344 if (extension == 5 && no5s > 0) needed = true; | |
345 if (extension == 7 && no7s > 0) needed = true; | |
346 if (extension == 9 && no9s > 0) needed = true; | |
347 if (extension == 11 && no11s > 0) needed = true; | |
348 if (extension == 13 && no13s > 0) needed = true; | |
349 return needed; | |
350 } | |
351 */ | |
352 | |
353 | |
354 //------------------------------------------------------------------------------------------------------------------------------- | |
355 | |
356 /* public int extensionMatch(){ | |
357 int returnValue = -1; | |
358 for (int i = 0; i < 16; i++){ | |
359 if( hvArray[i] == 1 && no1s > 0){ | |
360 returnValue = hvArray[i]; | |
361 break; | |
362 } | |
363 if( hvArray[i] == 3 && no3s > 0){ | |
364 returnValue = hvArray[i]; | |
365 break; | |
366 } | |
367 if( hvArray[i] == 5 && no5s > 0){ | |
368 returnValue = hvArray[i]; | |
369 break; | |
370 } | |
371 if( hvArray[i] == 7 && no7s > 0){ | |
372 returnValue = hvArray[i]; | |
373 break; | |
374 } | |
375 if( hvArray[i] == 9 && no9s > 0){ | |
376 returnValue = hvArray[i]; | |
377 break; | |
378 } | |
379 if( hvArray[i] == 11 && no11s > 0){ | |
380 returnValue = hvArray[i]; | |
381 break; | |
382 } | |
383 if( hvArray[i] == 13 && no13s > 0){ | |
384 returnValue = hvArray[i]; | |
385 break; | |
386 } | |
387 } | |
388 return returnValue; | |
389 } | |
390 | |
391 */ | |
392 | |
393 | |
394 | |
395 | |
396 //------------------------------------------------------------------------------------------------------------------------------- | |
397 | |
398 /* public boolean extensionPossible(int playingNotesi, int extentionNeeded){ | |
399 Boolean returnValue = true; | |
400 if (extentionNeeded != 1 && playingNotesi < 2) returnValue = false; | |
401 if ((extentionNeeded == 5 || extentionNeeded == 7 || extentionNeeded == 1) && playingNotesi == 3) returnValue = false; | |
402 if (!returnValue) println ("returning no on playingNotesi = " + playingNotesi + " and " + extentionNeeded); | |
403 return returnValue; | |
404 } | |
405 */ | |
406 | |
407 //------------------------------------------------------------------------------------------------------------------------------- | |
408 | |
409 /* public boolean disiredPitch(int pitch, int extension){ // returns a value for voice leading purposes. If true then pitch is already in current chord | |
410 if (pitch % 12 == getExtentionPitch(extension) % 12) | |
411 return true; | |
412 else return false; | |
413 } | |
414 */ | |
415 | |
416 //------------------------------------------------------------------------------------------------------------------------------- | |
417 | |
418 /* public int getExtentionPitch(int extension){ // | |
419 if (!heresyMinor){ | |
420 if (currentChord-tonic == 1) return tritoneSystem[extension/2]+currentChord; | |
421 if (currentChord-tonic == 7) return dom7System[extension/2]+currentChord; | |
422 if (currentChord-tonic != 1 || currentChord-tonic != 7) return major7System[extension/2]+currentChord; | |
423 } | |
424 if (heresyMinor) | |
425 return minorSystem[extension/2]+currentChord; | |
426 else | |
427 return -1; | |
428 } | |
429 */ | |
430 | |
431 | |
432 //------------------------------------------------------------------------------------------------------------------------------- | |
433 | |
434 /* public void extensionCounter(boolean positive, int currentDesiredExtention){ | |
435 if (currentDesiredExtention == 1) if (positive) no1s++; else no1s--; | |
436 if (currentDesiredExtention == 3) if (positive) no3s++; else no3s--; | |
437 if (currentDesiredExtention == 5) if (positive) no5s++; else no5s--; | |
438 if (currentDesiredExtention == 7) if (positive) no7s++; else no7s--; | |
439 if (currentDesiredExtention == 9) if (positive) no9s++; else no9s--; | |
440 if (currentDesiredExtention == 11) if (positive) no11s++; else no11s--; | |
441 if (currentDesiredExtention == 13) if (positive) no13s++; else no13s--; | |
442 } | |
443 */ | |
444 | |
445 //------------------------------------------------------------------------------------------------------------------------------- | |
446 | |
447 public void workOutExtensions(){ // calculates whether the performer wants chord extensions | |
448 if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[3]) | |
449 tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] = null; | |
450 if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[2]) | |
451 tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] = null; | |
452 if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[1]) | |
453 tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] = null; | |
454 if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[0]) | |
455 tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] = null; | |
456 | |
457 if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
458 heresy7th = true; | |
459 if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
460 heresy7th = false; | |
461 if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
462 heresy9th = true; | |
463 if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
464 heresy9th = false; | |
465 if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
466 heresy11th = true; | |
467 if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
468 heresy11th = false; | |
469 if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
470 heresy13th = true; | |
471 if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
472 heresy13th = false; | |
473 //--- | |
474 if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[3]) | |
475 chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] = null; | |
476 if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[2]) | |
477 chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] = null; | |
478 if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[1]) | |
479 chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] = null; | |
480 if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[0]) | |
481 chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] = null; | |
482 | |
483 if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
484 heresy7th = true; | |
485 if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
486 heresy7th = false; | |
487 if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
488 heresy9th = true; | |
489 if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
490 heresy9th = false; | |
491 if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
492 heresy11th = true; | |
493 if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
494 heresy11th = false; | |
495 if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
496 heresy13th = true; | |
497 if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
498 heresy13th = false; | |
499 | |
500 } | |
501 | |
502 | |
503 //------------------------------------------------------------------------------------------------------------------------------- | |
504 | |
505 public void workOutChord(){ // calculates current chord and major minor tonality | |
506 for (int i = 4; i < 16; i++) { | |
507 if (tracks[0] != null){ | |
508 if ((tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)].noteVelocity > 0 )|| | |
509 (chordsTemp.sequence[i][currentPulse%(tracks[0].loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0 )){ | |
510 currentChord = 15 - i; | |
511 boolean iiDone = false; | |
512 for (int ii = 0;; ii--){ | |
513 if (ii == 0 && iiDone) | |
514 break; | |
515 if (currentPulse%(tracks[0].loopLength)+ii == 0) | |
516 ii = tracks[0].loopLength+ii-1; | |
517 if (i > 3){ | |
518 if ((tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii] != null && tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii].noteVelocity == 0 ) || | |
519 (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity == 0 )) | |
520 break; | |
521 if ((tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii] != null && tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii].noteVelocity != 0 ) || | |
522 (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity != 0 )){ | |
523 heresyMinor = true; | |
524 break; | |
525 }else | |
526 heresyMinor = false; | |
527 } | |
528 iiDone = true; | |
529 } | |
530 } | |
531 } | |
532 } | |
533 } | |
534 | |
535 | |
536 //------------------------------------------------------------------------------------------------------------------------------- | |
537 | |
538 public void heresyChangeHistory(){ // remembers whether the chords or extensions have changed | |
539 if (currentChord != lastChord){ | |
540 heresyChordChanged = true; | |
541 lastChord = currentChord; | |
542 heresyChange = true; | |
543 } | |
544 if (heresyMinor != oldHeresyMinor){ | |
545 heresyMinorChanged = true; | |
546 oldHeresyMinor = heresyMinor; | |
547 heresyChange = true; | |
548 } | |
549 if (heresy7th != oldHeresy7th){ | |
550 heresy7thChanged = true; | |
551 oldHeresy7th = heresy7th; | |
552 heresyChange = true; | |
553 } | |
554 if (heresy9th != oldHeresy9th){ | |
555 heresy9thChanged = true; | |
556 oldHeresy9th = heresy9th; | |
557 heresyChange = true; | |
558 } | |
559 if (heresy11th != oldHeresy11th){ | |
560 heresy11thChanged = true; | |
561 oldHeresy11th = heresy11th; | |
562 heresyChange = true; | |
563 } | |
564 if (heresy13th != oldHeresy13th){ | |
565 heresy13thChanged = true; | |
566 oldHeresy13th = heresy13th; | |
567 heresyChange = true; | |
568 } | |
569 } | |
570 | |
571 | |
572 | |
573 | |
574 |