Mercurial > hg > movesynth
comparison HeresyBigBangDone/application.macosx/source/HeresyBigBangDone.java @ 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 import processing.core.*; | |
2 import processing.xml.*; | |
3 | |
4 import oscP5.*; | |
5 import netP5.*; | |
6 import maxlink.*; | |
7 import processing.opengl.*; | |
8 | |
9 import com.cycling74.max.*; | |
10 import com.cycling74.net.*; | |
11 import com.cycling74.msp.*; | |
12 import netP5.*; | |
13 import maxlink.*; | |
14 import com.cycling74.io.*; | |
15 import com.cycling74.util.*; | |
16 import com.cycling74.mxjedit.*; | |
17 import oscP5.*; | |
18 | |
19 import java.applet.*; | |
20 import java.awt.Dimension; | |
21 import java.awt.Frame; | |
22 import java.awt.event.MouseEvent; | |
23 import java.awt.event.KeyEvent; | |
24 import java.awt.event.FocusEvent; | |
25 import java.awt.Image; | |
26 import java.io.*; | |
27 import java.net.*; | |
28 import java.text.*; | |
29 import java.util.*; | |
30 import java.util.zip.*; | |
31 import java.util.regex.*; | |
32 | |
33 public class HeresyBigBangDone extends PApplet { | |
34 | |
35 | |
36 | |
37 public void setup(){ | |
38 markovStuff(); | |
39 for (int i = 0; i < 16; i++) | |
40 VPA[i] = new VPArray(); // creates the virtual playing array for Heresy AI. | |
41 for (int i = 0; i < noteOnArray.length; i++) | |
42 noteOnArray[i] = false; // makes sure there are initial random inputs from openFrameworks | |
43 | |
44 oscP5return = new OscP5(this,12346); | |
45 | |
46 frameRate(tempo); | |
47 img = createGraphics(imageWidth,imageHeight,P2D); | |
48 size(800,imageHeight,P2D); | |
49 arial = createFont("Arial",32); | |
50 textFont(arial,15); | |
51 | |
52 // initialize the tracks | |
53 | |
54 tracks[0] = new Track("Chord track", true, grid * beatsPerBar, 8, true, true); | |
55 tracks[1] = new Track("Drums", true, grid * beatsPerBar, 8, false, true); | |
56 tracks[2] = new Track("Bass", true, grid * beatsPerBar, 8, false, true); | |
57 tracks[3] = new Track("Pizz Strings", true, grid * beatsPerBar, 8, false, true); | |
58 tracks[4] = new Track("Synth", true, grid * beatsPerBar, 8, false, true); | |
59 tracks[5] = new Track("Voice", true, grid * beatsPerBar, 8, false, true); | |
60 tracks[6] = new Track("Voice", true, grid * beatsPerBar, 8, false, true); | |
61 chordsTemp = new Track("Chord track", true, loopLength, 8, true, false); | |
62 trSelected = 1; | |
63 backgroundColour(); | |
64 drawLines(); | |
65 drawBarLines(); | |
66 imgNoteFan = createGraphics(fanWidth,imageHeight,P2D); | |
67 lastTrack = trSelected; | |
68 clickTrackOn = true; | |
69 // loadSequences(); | |
70 // tracks[2].sequence[15][16] = new NoteEvent (14, 2, bar,beat,fraction,pulse); | |
71 // tracks[2].sequence[15][grid * beatsPerBar -20] = new NoteEvent (14, 2, bar,beat,fraction,pulse, true); | |
72 | |
73 // tracks[3].sequence[13][16] = new NoteEvent (13, 3, bar,beat,fraction,pulse); | |
74 // tracks[3].sequence[13][20] = new NoteEvent (13, 3, bar,beat,fraction,pulse, true); | |
75 // tracks[3].sequence[12][16] = new NoteEvent (12, 3, bar,beat,fraction,pulse); | |
76 // tracks[3].sequence[12][20] = new NoteEvent (12, 3, bar,beat,fraction,pulse, true); | |
77 // tracks[3].sequence[11][16] = new NoteEvent (11, 3, bar,beat,fraction,pulse); | |
78 // tracks[3].sequence[11][20] = new NoteEvent (11, 3, bar,beat,fraction,pulse, true); | |
79 // tracks[3].sequence[10][16] = new NoteEvent (10, 3, bar,beat,fraction,pulse); | |
80 // tracks[3].sequence[10][20] = new NoteEvent (10, 3, bar,beat,fraction,pulse, true); | |
81 } | |
82 | |
83 | |
84 //------------------------------------------------------------------------------------------------------------------------------- | |
85 | |
86 public void draw(){ | |
87 /* if (currentPulse % (grid * beatsPerBar) == grid * beatsPerBar -1){ | |
88 int tempTrackSelected = trSelected; | |
89 for (int j = 0; j < 16; j++){ | |
90 trSelected = j; | |
91 if (tracks[j] != null){ | |
92 for (int i = 0; i < 16; i++){ | |
93 noteOnArray[i] = false; | |
94 finishNote(i); | |
95 displayNoteOnArray[i] = false; | |
96 for (int z = 24; z < 109; z++) | |
97 outputToMax(z, 0, j); | |
98 } | |
99 tracks[j] = new Track(tracks[j].name, true, tracks[j].loopLength, tracks[j].quantize, false, false); | |
100 imgNotes = null; | |
101 } | |
102 } | |
103 trSelected = tempTrackSelected; | |
104 } | |
105 */ | |
106 // tracks[0] = new Track("Chord track", true, grid * beatsPerBar, 8, true, true); | |
107 // tracks[1] = new Track("Drums", true, grid * beatsPerBar, 8, false, true); | |
108 // tracks[2] = new Track("Bass", true, grid * beatsPerBar, 8, false, true); | |
109 // tracks[3] = new Track("Pizz Strings", true, grid * beatsPerBar, 8, false, true); | |
110 // tracks[4] = new Track("Synth", true, grid * beatsPerBar, 8, false, true); | |
111 // tracks[5] = new Track("Voice", true, grid * beatsPerBar, 8, false, true); | |
112 // } | |
113 workOutPosition(); // calculates current bar, beat and pulse position | |
114 //println(bar + " " + beat + " " + fraction + " " + pulse); | |
115 // if (chordAI && bar > 1) | |
116 // chordCalc(); | |
117 if (eraseOn) | |
118 eraseNotes(); | |
119 calcColours(); // calcs chord colours for background and grid | |
120 heresyChange = false; | |
121 heresyChordChanged = false; | |
122 if (trackStorer != trSelected){ // resets display when changing tracks | |
123 for (int i = 0; i < 16; i++) | |
124 if (noteOnArray[i] = true){ | |
125 noteOnArray[i] = false; | |
126 displayNoteOnArray[i] = false; | |
127 } | |
128 trackStorer = trSelected; | |
129 imgNotes = null; | |
130 } | |
131 if (imgNotes == null) | |
132 imgNotes = createGraphics(tracks[trSelected].loopLength,imageHeight,P2D); | |
133 background(0); | |
134 image (img,width-x2-playArea,0); | |
135 drawTempImageGrid(); | |
136 createNoteFan(); | |
137 drawNotes(); | |
138 fill (0); | |
139 noStroke(); | |
140 rect (width-playArea,0,playArea,height); | |
141 image (imgNoteFan, width-playArea+3,0); | |
142 pulseFrame(x); // Draws a pulsing white line at the left edge of the edit area | |
143 if (haveQuestion) writeQuestion(); // for input request messages | |
144 x++; // counter for grid movement | |
145 x2++; // counter for note image movement | |
146 if (x2 == width - playArea + grid * beatsPerBar) | |
147 x2 = width - playArea; | |
148 if (x == width - playArea + tracks[trSelected].loopLength) | |
149 x = width - playArea; | |
150 | |
151 | |
152 /* if (clickTrackOn){ // click track | |
153 if (fraction == 1){ | |
154 if (pulse == 1){ | |
155 String noteOut = ("37 80 1"); | |
156 link.output(noteOut); | |
157 } | |
158 if (pulse == 2){ | |
159 String noteOut = ("37 0 1" ); | |
160 link.output(noteOut); | |
161 } | |
162 } | |
163 } | |
164 */ | |
165 checkForMutes(); | |
166 checkCycled(); | |
167 playTrackEvents(); | |
168 | |
169 fill(255,255,255); | |
170 textSize(15); | |
171 text(bar + " " + beat + " " + fraction + " " + pulse, 10,20); // draws current time position to screen | |
172 | |
173 fill(200,0,0); | |
174 textSize(15); | |
175 // this section draws current track and track info to screen | |
176 if (tracks[trSelected].ducking) | |
177 text(tracks[trSelected].name + " ducking", 100,20); | |
178 else | |
179 text(tracks[trSelected].name, 100,20); | |
180 if (tracks[trSelected].muteIn > bar) | |
181 if (!tracks[trSelected].mute) | |
182 text("mute in " + (tracks[trSelected].muteIn - bar), 200,20); | |
183 else | |
184 text("unmute in " + (tracks[trSelected].muteIn - bar), 200,20); | |
185 | |
186 if (haveQuestion){ // asks input questions | |
187 writeQuestion(); | |
188 } | |
189 // println(currentPulse + " "); | |
190 | |
191 | |
192 currentPulse++; // advances the sequencer to next pulse | |
193 } | |
194 | |
195 | |
196 //------------------------------------------------------------------------------------------------------------------------------- | |
197 | |
198 public void eraseNotes(){ // erases notes in current track if selected | |
199 if (trSelected != 0){ | |
200 for (int i = 0; i < 16; i++){ | |
201 if (tracks[trSelected].sequence[i][(currentPulse%(tracks[trSelected].loopLength))] != null){ | |
202 tracks[trSelected].sequence[i][(currentPulse%(tracks[trSelected].loopLength))] = null; | |
203 } | |
204 } | |
205 } | |
206 if (trSelected == 0){ | |
207 for (int i = 0; i < 16; i++){ | |
208 if (chordsTemp.sequence[i][(currentPulse%(tracks[trSelected].loopLength))] != null){ | |
209 chordsTemp.sequence[i][(currentPulse%(tracks[trSelected].loopLength))] = null; | |
210 } | |
211 } | |
212 } | |
213 } | |
214 | |
215 | |
216 //------------------------------------------------------------------------------------------------------------------------------- | |
217 | |
218 public void workOutPosition(){ // works out current position | |
219 if (currentPulse%(grid*beatsPerBar) == 0) | |
220 ++bar; | |
221 if (currentPulse%grid == 0) | |
222 ++beat; | |
223 if (beat > beatsPerBar) | |
224 beat = 1; | |
225 if (currentPulse%(grid/fractions) == 0) | |
226 ++fraction; | |
227 if (fraction > fractions) | |
228 fraction = 1; | |
229 ++pulse; | |
230 if (pulse > (grid/fractions)) | |
231 pulse = 1; | |
232 } | |
233 | |
234 | |
235 //------------------------------------------------------------------------------------------------------------------------------- | |
236 | |
237 public void finishNote(int noteArrayPosition){ // writes note offs into the sequencers | |
238 if (trSelected != 0) | |
239 tracks[trSelected].sequence[noteArrayPosition][(currentPulse%(tracks[trSelected].loopLength))] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse, true); | |
240 if (trSelected == 0) | |
241 chordsTemp.sequence[noteArrayPosition][(currentPulse%(chordsTemp.loopLength))] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse, true); | |
242 displayNoteOnArray[noteArrayPosition] = false; | |
243 } | |
244 | |
245 public void finishNote(int noteArrayPosition, int channel){ // writes note offs into the sequencers | |
246 if (trSelected != 0) | |
247 tracks[trSelected].sequence[noteArrayPosition][(currentPulse%(tracks[trSelected].loopLength))] = new NoteEvent (noteArrayPosition, channel, bar,beat,fraction,pulse, true); | |
248 if (trSelected == 0) | |
249 chordsTemp.sequence[noteArrayPosition][(currentPulse%(chordsTemp.loopLength))] = new NoteEvent (noteArrayPosition, channel, bar,beat,fraction,pulse, true); | |
250 displayNoteOnArray[noteArrayPosition] = false; | |
251 } | |
252 | |
253 | |
254 //----------------------------------------------------------------------------------------------------------------------------- | |
255 | |
256 public void finishNoteCutOff(int noteArrayPosition){ // writes note offs for unfinished notes in to the last track if track is changed and note ons are active | |
257 tracks[lastTrack].sequence[noteArrayPosition][(currentPulse%(tracks[lastTrack].loopLength))] = new NoteEvent (noteArrayPosition, lastTrack+1, bar,beat,fraction,pulse, true); | |
258 } | |
259 | |
260 | |
261 //------------------------------------------------------------------------------------------------------------------------------- | |
262 | |
263 public void writeNote(int noteArrayPosition, int veloc){ // writes note ons into the sequencers | |
264 if (trSelected != 0){ | |
265 int quantizeOffset = getQuantizeOffset(); | |
266 if (quantizeOffset >= 0){ | |
267 tracks[trSelected].sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); | |
268 } | |
269 if (quantizeOffset < 0){ | |
270 tracks[trSelected].sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); | |
271 | |
272 VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNoteOn = true; | |
273 if (trSelected !=1 && trSelected !=5) | |
274 VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 3); | |
275 else | |
276 VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 1); | |
277 VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNoteVelocity = veloc; | |
278 sendNote(VPA[trSelected].VPArrayNotes[noteArrayPosition], trSelected); | |
279 displayNoteOnArray[noteArrayPosition] = true; | |
280 | |
281 } | |
282 } | |
283 if (trSelected == 0){ | |
284 int quantizeOffset = getQuantizeOffset(); | |
285 if (quantizeOffset >= 0){ | |
286 chordsTemp.sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); | |
287 } | |
288 if (quantizeOffset < 0){ | |
289 chordsTemp.sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); | |
290 | |
291 if (noteArrayPosition > 3) | |
292 currentChord = 15 - noteArrayPosition; | |
293 displayNoteOnArray[noteArrayPosition] = true; | |
294 } | |
295 } | |
296 } | |
297 | |
298 public void writeNote(int noteArrayPosition, int veloc, int channel){ // writes note ons into the sequencers | |
299 VPA[channel].VPArrayNotes[noteArrayPosition].VPNoteOn = true; | |
300 VPA[channel].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 1); | |
301 VPA[channel].VPArrayNotes[noteArrayPosition].VPNoteVelocity = veloc; | |
302 sendNote(VPA[channel].VPArrayNotes[noteArrayPosition], channel); | |
303 } | |
304 | |
305 | |
306 | |
307 | |
308 //------------------------------------------------------------------------------------------------------------------------------- | |
309 | |
310 public int getQuantizeOffset(){ // tells write note method the quantize offset. | |
311 int quantizeInPulses = pulsesPerBar/(tracks[trSelected].quantize); | |
312 int quantizeOffset = currentPulse % quantizeInPulses; | |
313 if (quantizeOffset > quantizeInPulses/2.0f){ | |
314 return ((quantizeOffset - quantizeInPulses) * -1) ; | |
315 } | |
316 else{ | |
317 return quantizeOffset * -1; | |
318 } | |
319 } | |
320 | |
321 | |
322 | |
323 //------------------------------------------------------------------------------------------------------------------------------- | |
324 | |
325 public void drawNotes(){ // places the note display grid into the apropriate screen positions | |
326 int loopsOnScreen = ((width-playArea) / tracks[trSelected].loopLength) + 1; | |
327 if (loopsOnScreen > currentPulse / tracks[trSelected].loopLength) | |
328 loopsOnScreen = currentPulse / tracks[trSelected].loopLength; | |
329 for (int i = 0; i <= loopsOnScreen; i++) | |
330 image (imgNotes, (width-playArea-(i*tracks[trSelected].loopLength))-currentPulse%(tracks[trSelected].loopLength),0); | |
331 } | |
332 | |
333 | |
334 | |
335 //------------------------------------------------------------------------------------------------------------------------------- | |
336 | |
337 public void pulseFrame(int frameNo){ // Draws a pulsing line at left hand side of the input area when loop restarts | |
338 strokeWeight(3); | |
339 if (currentPulse % (tracks[trSelected].loopLength) == 0 || (currentPulse-1) % (tracks[trSelected].loopLength) == 0 || (currentPulse-2) % (tracks[trSelected].loopLength) == 0) | |
340 stroke(255,255,255); | |
341 else | |
342 stroke(255,111,111); | |
343 line (width-playArea+3, 1, width-playArea+3, 300); | |
344 } | |
345 | |
346 | |
347 //------------------------------------------------------------------------------------------------------------------------------- | |
348 | |
349 public void drawTempImageGrid(){ // draws the note display image grid | |
350 imgNotes.stroke(209,137,255); | |
351 imgNotes.strokeWeight(15); | |
352 for(int i = 0; i < 16; i++){ | |
353 if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ | |
354 imgNotes.beginDraw(); | |
355 imgNotes.line (currentPulse%(tracks[trSelected].loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(tracks[trSelected].loopLength)+1, i*imageHeight/16+imageHeight/32); | |
356 imgNotes.endDraw(); | |
357 displayNoteOnArray[i] = true; | |
358 } | |
359 if (tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity == 0){ | |
360 displayNoteOnArray[i] = false; | |
361 } | |
362 | |
363 if(trSelected ==0){ | |
364 if ((chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ | |
365 imgNotes.beginDraw(); | |
366 imgNotes.line (currentPulse%(chordsTemp.loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(chordsTemp.loopLength)+1, i*imageHeight/16+imageHeight/32); | |
367 imgNotes.endDraw(); | |
368 displayNoteOnArray[i] = true; | |
369 } | |
370 if (chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0){ | |
371 displayNoteOnArray[i] = false; | |
372 } | |
373 } | |
374 } | |
375 } | |
376 | |
377 | |
378 //------------------------------------------------------------------------------------------------------------------------------- | |
379 | |
380 public void drawLines(){ // draws beat lines | |
381 int linePosition = 1; | |
382 int i = 0; | |
383 for (; linePosition <= imageWidth;){ | |
384 linePosition = i * grid; | |
385 img.beginDraw(); | |
386 img.stroke(lineColour); | |
387 img.strokeWeight(2); | |
388 img.line (linePosition, 0, linePosition, imageHeight); | |
389 img.endDraw(); | |
390 i++; | |
391 } | |
392 } | |
393 | |
394 | |
395 //------------------------------------------------------------------------------------------------------------------------------- | |
396 | |
397 public void drawBarLines(){ // draws bar lines | |
398 int linePosition = 1; | |
399 for (int i = 0; linePosition <= imageWidth;){ | |
400 linePosition = i * grid * beatsPerBar; | |
401 img.beginDraw(); | |
402 img.stroke(barLineColour); | |
403 img.strokeWeight(2); | |
404 img.line (linePosition, 0, linePosition, imageHeight); | |
405 img.endDraw(); | |
406 i++; | |
407 } | |
408 } | |
409 | |
410 | |
411 //------------------------------------------------------------------------------------------------------------------------------- | |
412 | |
413 public void backgroundColour(){ // sets background colour | |
414 img.beginDraw(); | |
415 img.background (backGround); | |
416 img.endDraw(); | |
417 } | |
418 | |
419 | |
420 | |
421 //------------------------------------------------------------------------------------------------------------------------------- | |
422 | |
423 public void createNoteFan(){ // creates the input fan | |
424 if (rpulseup) | |
425 rpulse++; | |
426 else rpulse--; | |
427 if (rpulse == grid) | |
428 rpulseup = false; | |
429 if (rpulse < 1) | |
430 rpulseup = true; | |
431 imgNoteFan.beginDraw(); | |
432 imgNoteFan.stroke(rpulse/grid*255,50,50); | |
433 imgNoteFan.strokeWeight(1); | |
434 for (int i = 0; i < 16; i++){ | |
435 if (!chordSelecter) | |
436 if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ | |
437 imgNoteFan.fill(209,137,255); | |
438 } | |
439 else | |
440 imgNoteFan.fill(0,0,0); | |
441 else | |
442 if (i == 14 || i == 12 || i == 9 || i == 7 || i == 5 || i == 3 || i == 2 || i == 1 || i == 0) | |
443 imgNoteFan.fill(0,0,0); | |
444 else | |
445 imgNoteFan.fill(255,255,255); | |
446 imgNoteFan.quad(0, i*(imageHeight/16.0f), 0, (i+1)*(imageHeight/16.0f), fanWidth, (imageHeight/2.0f), fanWidth, (imageHeight/2.0f)); | |
447 } | |
448 | |
449 imgNoteFan.endDraw(); | |
450 | |
451 } | |
452 | |
453 //------------------------------------------------------------------------------------------------------------------------------- | |
454 | |
455 public void calcColours(){ // sets up colour values for background, bar and beat lines | |
456 | |
457 if(heresyChordChanged){ | |
458 | |
459 if(currentChord == 0){ | |
460 redC = 0; | |
461 greenC = 0; | |
462 blueC = 0; | |
463 } | |
464 | |
465 if(currentChord == 1){ | |
466 redC = 90; | |
467 greenC = 76; | |
468 blueC = 3; | |
469 } | |
470 | |
471 if(currentChord == 2){ | |
472 redC = 254; | |
473 greenC = 255; | |
474 blueC = 18; | |
475 } | |
476 | |
477 if(currentChord == 3){ | |
478 redC = 0; | |
479 greenC = 0; | |
480 blueC = 0; | |
481 } | |
482 | |
483 if(currentChord == 4){ | |
484 redC = 136; | |
485 greenC = 245; | |
486 blueC = 49; | |
487 } | |
488 | |
489 if(currentChord == 5){ | |
490 redC = 9; | |
491 greenC = 18; | |
492 blueC = 232; | |
493 } | |
494 | |
495 if(currentChord == 6){ | |
496 redC = 99; | |
497 greenC = 99; | |
498 blueC = 100; | |
499 } | |
500 | |
501 if(currentChord == 7){ | |
502 redC = 255; | |
503 greenC = 166; | |
504 blueC = 21; | |
505 } | |
506 | |
507 if(currentChord == 8){ | |
508 redC = 13; | |
509 greenC = 79; | |
510 blueC = 147; | |
511 } | |
512 | |
513 if(currentChord == 9){ | |
514 redC = 255; | |
515 greenC = 165; | |
516 blueC = 165; | |
517 } | |
518 | |
519 if(currentChord == 10){ | |
520 redC = 89; | |
521 greenC = 110; | |
522 blueC = 134; | |
523 } | |
524 | |
525 if(currentChord == 11){ | |
526 redC = 68; | |
527 greenC = 242; | |
528 blueC = 250; | |
529 } | |
530 | |
531 backGround = color(redC, greenC, blueC); | |
532 lineColour = color((redC + 100) % 255,(greenC + 69) % 255,(blueC + 214) % 255); | |
533 barLineColour = color((redC + 205) % 255, (greenC + 174) % 255, (blueC + 159) % 255); | |
534 | |
535 backgroundColour(); | |
536 drawLines(); | |
537 drawBarLines(); | |
538 } | |
539 } | |
540 | |
541 | |
542 | |
543 | |
544 | |
545 | |
546 | |
547 | |
548 OscP5 oscP5return; | |
549 NetAddress ableton = new NetAddress("localhost", 12345); // OSC to ableton | |
550 MaxLink link = new MaxLink(this, "midiCom"); | |
551 | |
552 int imageWidth = 1000; | |
553 int imageHeight = 300; | |
554 int fanWidth = 400; | |
555 | |
556 float rpulse; | |
557 boolean rpulseup; | |
558 boolean clickTrack; | |
559 int currentPulse = 0; | |
560 int grid = 32; | |
561 int fractions = 4; | |
562 int pulseFrequency = grid / fractions; | |
563 int beatsPerBar = 4; | |
564 int bar = 0, beat = 0, fraction = 0, pulse = 0; | |
565 int pulsesPerBar = beatsPerBar * grid; | |
566 | |
567 int lineColour = color(150,150,150); | |
568 int barLineColour = color(255,255,95); | |
569 int backGround = color(50,81,191); | |
570 int redC = 50; | |
571 int greenC = 81; | |
572 int blueC = 191; | |
573 PImage screenImage; | |
574 PGraphics img, imgNotes, imgNoteFan; | |
575 PImage test; | |
576 | |
577 int barOfPixels = grid * beatsPerBar; | |
578 int playArea = 200; | |
579 int x= 0; | |
580 int x2= 0; | |
581 PFont arial; | |
582 int arraySize = 800-playArea; | |
583 int bpm = 130; | |
584 int tempo = bpm/60*grid; | |
585 int noOfBars = 2; | |
586 int loopLength = grid*beatsPerBar*noOfBars; | |
587 Track[] tracks = new Track[16]; | |
588 Track chordsTemp; | |
589 int trSelected; | |
590 boolean[] noteOnArray = new boolean[16]; | |
591 boolean[] displayNoteOnArray = new boolean[16]; | |
592 int[] noteOnArrayLength = new int[16]; | |
593 boolean chordSelecter, clickTrackOn; | |
594 int lastTrack; | |
595 int trackStorer, screenAni; | |
596 boolean quantizeValueIn, loopLengthValueIn, haveQuestion, aniOut, muteValueIn; | |
597 String screenQuestion; | |
598 boolean eraseOn; | |
599 | |
600 int crneeded = 24; | |
601 int noOfChords; | |
602 boolean tonicNeeded; | |
603 boolean chordAI = true; | |
604 int lastChordChange; | |
605 boolean lastMinor; | |
606 int barCounter; | |
607 | |
608 boolean heresyMinor, oldHeresyMinor, heresy7th, oldHeresy7th, heresy9th, oldHeresy9th, heresy11th, oldHeresy11th, heresy13th, oldHeresy13th, heresyDom; | |
609 boolean heresyMinorChanged, heresyChordChanged, heresy7thChanged, heresy9thChanged, heresy11thChanged, heresy13thChanged, heresyChange, dontRevoice; | |
610 int currentChord, lastChord; | |
611 VPArray[] VPA = new VPArray[16]; | |
612 int[] notesOnArray = new int[16]; | |
613 int no1s = 0; int no3s = 0; int no5s = 0; int no7s = 0; int no9s = 0; int no11s = 0; int no13s = 0; | |
614 int tonic = 0; | |
615 | |
616 | |
617 | |
618 | |
619 | |
620 //------------------------------------------------------------------------------------------------------------------------------- | |
621 | |
622 /* public int getHeresyPitch(int extension, int notePosition){ // delivers heresy pitches | |
623 int value = getExtentionPitch(extension) % 12; | |
624 if (notePosition == 15) value += 24; | |
625 if (notePosition == 14) value += 36; | |
626 if (notePosition == 13) value += 36; | |
627 if (notePosition == 12) value += 48; | |
628 if (notePosition == 11) value += 48; | |
629 if (notePosition == 10) value += 48; | |
630 if (notePosition == 9) value += 48; | |
631 if (notePosition == 8) value += 60; | |
632 if (notePosition == 7) value += 60; | |
633 if (notePosition == 6) value += 60; | |
634 if (notePosition == 5) value += 60; | |
635 if (notePosition == 4) value += 72; | |
636 if (notePosition == 3) value += 72; | |
637 if (notePosition == 2) value += 72; | |
638 if (notePosition == 1) value += 72; | |
639 if (notePosition == 0) value += 84; | |
640 return value; | |
641 }*/ | |
642 | |
643 | |
644 public int heresyPitchInfo(int arrayPosition){ // returns a value for checking if note required is currently playing | |
645 int value = 0; | |
646 if (heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){ | |
647 if (arrayPosition == 15) value = (15-currentChord) + 24; | |
648 if (arrayPosition == 14) value = (15-currentChord) + 36; | |
649 if (arrayPosition == 13) value = (15-currentChord) + 43; | |
650 if (arrayPosition == 12) value = (15-currentChord) + 50; | |
651 if (arrayPosition == 11) value = (15-currentChord) + 51; | |
652 if (arrayPosition == 10) value = (15-currentChord) + 58; | |
653 if (arrayPosition == 9) value = (15-currentChord) + 65; | |
654 if (arrayPosition == 8) value = (15-currentChord) + 67; | |
655 if (arrayPosition == 7) value = (15-currentChord) + 70; | |
656 if (arrayPosition == 6) value = (15-currentChord) + 72; | |
657 if (arrayPosition == 5) value = (15-currentChord) + 74; | |
658 if (arrayPosition == 4) value = (15-currentChord) + 75; | |
659 if (arrayPosition == 3) value = (15-currentChord) + 77; | |
660 if (arrayPosition == 2) value = (15-currentChord) + 79; | |
661 if (arrayPosition == 1) value = (15-currentChord) + 82; | |
662 if (arrayPosition == 0) value = (15-currentChord) + 84; | |
663 } | |
664 if (!heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){ | |
665 if (arrayPosition == 15) value = (15-currentChord) + 24; | |
666 if (arrayPosition == 14) value = (15-currentChord) + 36; | |
667 if (arrayPosition == 13) value = (15-currentChord) + 43; | |
668 if (arrayPosition == 12) value = (15-currentChord) + 50; | |
669 if (arrayPosition == 11) value = (15-currentChord) + 52; | |
670 if (arrayPosition == 10) value = (15-currentChord) + 59; | |
671 if (arrayPosition == 9) value = (15-currentChord) + 66; | |
672 if (arrayPosition == 8) value = (15-currentChord) + 71; | |
673 if (arrayPosition == 7) value = (15-currentChord) + 74; | |
674 if (arrayPosition == 6) value = (15-currentChord) + 78; | |
675 if (arrayPosition == 5) value = (15-currentChord) + 83; | |
676 if (arrayPosition == 4) value = (15-currentChord) + 75; | |
677 if (arrayPosition == 3) value = (15-currentChord) + 77; | |
678 if (arrayPosition == 2) value = (15-currentChord) + 79; | |
679 if (arrayPosition == 1) value = (15-currentChord) + 82; | |
680 if (arrayPosition == 0) value = (15-currentChord) + 84; | |
681 } | |
682 return value; | |
683 } | |
684 | |
685 | |
686 //------------------------------------------------------------------------------------------------------------------------------- | |
687 | |
688 public void playTrackEvents(){ // initiates the playing Heresy AI logic | |
689 | |
690 workOutExtensions(); | |
691 //workOutChord(); | |
692 heresyChangeHistory(); | |
693 VpaNoteStater(); | |
694 // heresyVoicingArray(); | |
695 countNoteOns(); | |
696 | |
697 | |
698 } | |
699 | |
700 | |
701 //------------------------------------------------------------------------------------------------------------------------------- | |
702 | |
703 public void sendNoteEvents(){ // sends sequencer evernts to the IO section for out put to max | |
704 for(int i = 1; i < Track.currentNumberOfTracks; i++){ | |
705 if (tracks[i] != null ){ | |
706 for (int ii = 0; ii < 16; ii++) { | |
707 if (!VPA[i].VPArrayNotes[ii].played){ | |
708 outputToMax (VPA[i].VPArrayNotes[ii].VPNotePitch, VPA[i].VPArrayNotes[ii].VPNoteVelocity, i); | |
709 VPA[i].VPArrayNotes[ii].played = true; | |
710 } | |
711 } | |
712 } | |
713 } | |
714 } | |
715 | |
716 | |
717 //------------------------------------------------------------------------------------------------------------------------------- | |
718 | |
719 public void VpaNoteStater(){ // calculates pitches based on Heresy AI voice leading and voicing tables. | |
720 for(int i = 1; i < Track.currentNumberOfTracks; i++){ | |
721 if (tracks[i] != null){ | |
722 for (int ii = 0; ii < 16; ii++) { | |
723 if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)] != null){ | |
724 if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity != 0){ | |
725 if (VPA[i].VPArrayNotes[ii].VPNoteOn && heresyPitchInfo(ii) != VPA[i].VPArrayNotes[ii].VPNotePitch){ | |
726 // println("in..."); | |
727 VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0; | |
728 sendNote(VPA[i].VPArrayNotes[ii], i); | |
729 if (i != 1 && i != 5) | |
730 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3); | |
731 else | |
732 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1); | |
733 VPA[i].VPArrayNotes[ii].VPNoteVelocity = tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity; | |
734 sendNote(VPA[i].VPArrayNotes[ii], i); | |
735 }else{ | |
736 // println("in2..."); | |
737 if (i != 1 && i != 5) | |
738 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3); | |
739 else | |
740 VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1); | |
741 VPA[i].VPArrayNotes[ii].VPNoteVelocity = tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity; | |
742 sendNote(VPA[i].VPArrayNotes[ii], i); | |
743 } | |
744 } | |
745 if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity == 0){ | |
746 VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0; | |
747 sendNote(VPA[i].VPArrayNotes[ii], i); | |
748 } | |
749 } | |
750 } | |
751 } | |
752 } | |
753 } | |
754 | |
755 | |
756 //------------------------------------------------------------------------------------------------------------------------------- | |
757 | |
758 /* public void heresyVoicingArray(){ // sets the voicing array to be used for note ons | |
759 if (!heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice135; | |
760 if (heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice7; | |
761 if (!heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice9; | |
762 if (!heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice11; | |
763 if (!heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice13; | |
764 if (heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice79; | |
765 if (heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice711; | |
766 if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice713; | |
767 if (!heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice911; | |
768 if (!heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice913; | |
769 if (!heresy7th && !heresy9th && heresy11th && heresy13th) hvArray = hchoice1113; | |
770 if (heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice7911; | |
771 if (heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice7913; | |
772 if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice71113; | |
773 if (!heresy7th && heresy9th && heresy11th && heresy13th) hvArray = hchoice91113; | |
774 } | |
775 | |
776 */ | |
777 | |
778 | |
779 //------------------------------------------------------------------------------------------------------------------------------- | |
780 | |
781 public void countNoteOns(){ // counts the note ons for all tracks | |
782 for (int ii = 0; ii < 16; ii++){ | |
783 notesOnArray[ii] = 0;} | |
784 for(int i = 1; i < Track.currentNumberOfTracks; i++){ | |
785 for (int ii = 0; ii < 16; ii++){ | |
786 if (VPA[i].VPArrayNotes[ii].VPNoteOn == true) | |
787 notesOnArray[i]++; | |
788 } | |
789 } | |
790 } | |
791 | |
792 | |
793 //------------------------------------------------------------------------------------------------------------------------------- | |
794 | |
795 /* public void calculateHeresyNoteExtensions(){ | |
796 for(int tracki = 1; tracki < Track.currentNumberOfTracks; tracki++){ | |
797 no1s = 0; no3s = 0; no5s = 0; no7s = 0; no9s = 0; no11s = 0; no13s = 0; | |
798 | |
799 checkIfNotesAlreadyFit(tracki); | |
800 | |
801 calcRemainingNotes(tracki); | |
802 | |
803 for (int t = 0; t < 16; t++){ | |
804 VPA[tracki].VPArrayNotes[t].done = false; | |
805 } | |
806 } | |
807 } | |
808 | |
809 */ | |
810 | |
811 | |
812 //------------------------------------------------------------------------------------------------------------------------------- | |
813 | |
814 /* public void calcRemainingNotes(int tracki){ | |
815 int counter = -1; | |
816 int looped = 0; | |
817 while (no1s + no3s + no5s + no7s + no9s + no11s + no13s != 0){ | |
818 counter++; | |
819 if (counter >= notesOnArray[tracki]){ | |
820 counter = 0; | |
821 looped++; | |
822 } | |
823 int nextExtension = hvArray[counter]; | |
824 if(extensionNeeded(nextExtension)){ | |
825 for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ | |
826 if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){ | |
827 if (extensionPossible(playingNotesi, nextExtension)){ | |
828 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = getHeresyPitch(nextExtension, playingNotesi); | |
829 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
830 println("got pitch " + VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch); | |
831 // correctIfNeeded(tracki, playingNotesi, nextExtension); | |
832 }else println("wasn't possible"); | |
833 } | |
834 } | |
835 } | |
836 if (looped > 3) { | |
837 for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ | |
838 if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){ | |
839 VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn = false; | |
840 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -1; | |
841 } | |
842 } | |
843 System.out.println("Had to break_________________"); | |
844 break; | |
845 } | |
846 } | |
847 } | |
848 | |
849 */ | |
850 | |
851 | |
852 //------------------------------------------------------------------------------------------------------------------------------- | |
853 | |
854 /* 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 | |
855 boolean alreadyGotNote = false; boolean alreadyGotNotePlus12 = false; boolean alreadyGotNoteMinus12 = false; | |
856 int pitchAverage = 0; | |
857 for (int i = 0; i < 16; i++) | |
858 if (i != playingNotesi){ | |
859 if (VPA[tracki].VPArrayNotes[i].done) | |
860 pitchAverage += VPA[tracki].VPArrayNotes[i].VPNotePitch; | |
861 if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch) | |
862 alreadyGotNote = true; | |
863 if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12) | |
864 alreadyGotNotePlus12 = true; | |
865 if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12) | |
866 alreadyGotNoteMinus12 = true; | |
867 } | |
868 if (notesOnArray[tracki]-1 > 0) | |
869 pitchAverage = pitchAverage / (notesOnArray[tracki]-1); | |
870 else | |
871 pitchAverage = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch; | |
872 boolean correctedIt = false; | |
873 if (alreadyGotNote){ | |
874 println("correcting note.........."); | |
875 if (!alreadyGotNotePlus12 && pitchAverage > VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){ | |
876 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12; | |
877 correctedIt = true; | |
878 }else | |
879 if (!alreadyGotNoteMinus12){ | |
880 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12; | |
881 correctedIt = true; | |
882 } | |
883 if (!alreadyGotNoteMinus12 && pitchAverage < VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){ | |
884 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12; | |
885 correctedIt = true; | |
886 }else | |
887 if (!alreadyGotNotePlus12){ | |
888 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12; | |
889 correctedIt = true; | |
890 } | |
891 } | |
892 if (alreadyGotNote && !correctedIt) | |
893 VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -2; | |
894 if (!alreadyGotNote || correctedIt){ | |
895 VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80; | |
896 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
897 VPA[tracki].VPArrayNotes[playingNotesi].played = false; | |
898 extensionCounter(false, nextExtension); | |
899 }else{ | |
900 VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80; | |
901 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
902 } | |
903 } | |
904 | |
905 */ | |
906 | |
907 | |
908 //------------------------------------------------------------------------------------------------------------------------------- | |
909 | |
910 | |
911 | |
912 /* public void checkIfNotesAlreadyFit(int tracki){ | |
913 for (int extensioni = 0; extensioni < notesOnArray[tracki]; extensioni++){ | |
914 boolean extensionFound = false; | |
915 for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ | |
916 if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn && !VPA[tracki].VPArrayNotes[playingNotesi].done && !extensionFound && VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch >= 24){ | |
917 if (disiredPitch(VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch, hvArray[extensioni])){ | |
918 VPA[tracki].VPArrayNotes[playingNotesi].done = true; | |
919 extensionFound = true; | |
920 } | |
921 } | |
922 } | |
923 if (!extensionFound){ | |
924 extensionCounter(true, hvArray[extensioni]); | |
925 } | |
926 } | |
927 } | |
928 | |
929 */ | |
930 | |
931 | |
932 //------------------------------------------------------------------------------------------------------------------------------- | |
933 | |
934 /* public boolean pitchInChord(int currentPitch){ | |
935 boolean returnValue = false; | |
936 for (int i = 0; i < 16; i++){ | |
937 // println("currentPitch " + currentPitch + " getHeresyPitch(hvArray[i], 5) % 12) " + (getHeresyPitch(hvArray[i], 5))); | |
938 if (currentPitch % 12 == (getHeresyPitch(hvArray[i], 5) % 12)); | |
939 returnValue = true; | |
940 } | |
941 return returnValue; | |
942 } | |
943 */ | |
944 | |
945 //------------------------------------------------------------------------------------------------------------------------------- | |
946 | |
947 /* public boolean extensionNeeded(int extension){ | |
948 boolean needed = false; | |
949 if (extension == 1 && no1s > 0) needed = true; | |
950 if (extension == 3 && no3s > 0) needed = true; | |
951 if (extension == 5 && no5s > 0) needed = true; | |
952 if (extension == 7 && no7s > 0) needed = true; | |
953 if (extension == 9 && no9s > 0) needed = true; | |
954 if (extension == 11 && no11s > 0) needed = true; | |
955 if (extension == 13 && no13s > 0) needed = true; | |
956 return needed; | |
957 } | |
958 */ | |
959 | |
960 | |
961 //------------------------------------------------------------------------------------------------------------------------------- | |
962 | |
963 /* public int extensionMatch(){ | |
964 int returnValue = -1; | |
965 for (int i = 0; i < 16; i++){ | |
966 if( hvArray[i] == 1 && no1s > 0){ | |
967 returnValue = hvArray[i]; | |
968 break; | |
969 } | |
970 if( hvArray[i] == 3 && no3s > 0){ | |
971 returnValue = hvArray[i]; | |
972 break; | |
973 } | |
974 if( hvArray[i] == 5 && no5s > 0){ | |
975 returnValue = hvArray[i]; | |
976 break; | |
977 } | |
978 if( hvArray[i] == 7 && no7s > 0){ | |
979 returnValue = hvArray[i]; | |
980 break; | |
981 } | |
982 if( hvArray[i] == 9 && no9s > 0){ | |
983 returnValue = hvArray[i]; | |
984 break; | |
985 } | |
986 if( hvArray[i] == 11 && no11s > 0){ | |
987 returnValue = hvArray[i]; | |
988 break; | |
989 } | |
990 if( hvArray[i] == 13 && no13s > 0){ | |
991 returnValue = hvArray[i]; | |
992 break; | |
993 } | |
994 } | |
995 return returnValue; | |
996 } | |
997 | |
998 */ | |
999 | |
1000 | |
1001 | |
1002 | |
1003 //------------------------------------------------------------------------------------------------------------------------------- | |
1004 | |
1005 /* public boolean extensionPossible(int playingNotesi, int extentionNeeded){ | |
1006 Boolean returnValue = true; | |
1007 if (extentionNeeded != 1 && playingNotesi < 2) returnValue = false; | |
1008 if ((extentionNeeded == 5 || extentionNeeded == 7 || extentionNeeded == 1) && playingNotesi == 3) returnValue = false; | |
1009 if (!returnValue) println ("returning no on playingNotesi = " + playingNotesi + " and " + extentionNeeded); | |
1010 return returnValue; | |
1011 } | |
1012 */ | |
1013 | |
1014 //------------------------------------------------------------------------------------------------------------------------------- | |
1015 | |
1016 /* public boolean disiredPitch(int pitch, int extension){ // returns a value for voice leading purposes. If true then pitch is already in current chord | |
1017 if (pitch % 12 == getExtentionPitch(extension) % 12) | |
1018 return true; | |
1019 else return false; | |
1020 } | |
1021 */ | |
1022 | |
1023 //------------------------------------------------------------------------------------------------------------------------------- | |
1024 | |
1025 /* public int getExtentionPitch(int extension){ // | |
1026 if (!heresyMinor){ | |
1027 if (currentChord-tonic == 1) return tritoneSystem[extension/2]+currentChord; | |
1028 if (currentChord-tonic == 7) return dom7System[extension/2]+currentChord; | |
1029 if (currentChord-tonic != 1 || currentChord-tonic != 7) return major7System[extension/2]+currentChord; | |
1030 } | |
1031 if (heresyMinor) | |
1032 return minorSystem[extension/2]+currentChord; | |
1033 else | |
1034 return -1; | |
1035 } | |
1036 */ | |
1037 | |
1038 | |
1039 //------------------------------------------------------------------------------------------------------------------------------- | |
1040 | |
1041 /* public void extensionCounter(boolean positive, int currentDesiredExtention){ | |
1042 if (currentDesiredExtention == 1) if (positive) no1s++; else no1s--; | |
1043 if (currentDesiredExtention == 3) if (positive) no3s++; else no3s--; | |
1044 if (currentDesiredExtention == 5) if (positive) no5s++; else no5s--; | |
1045 if (currentDesiredExtention == 7) if (positive) no7s++; else no7s--; | |
1046 if (currentDesiredExtention == 9) if (positive) no9s++; else no9s--; | |
1047 if (currentDesiredExtention == 11) if (positive) no11s++; else no11s--; | |
1048 if (currentDesiredExtention == 13) if (positive) no13s++; else no13s--; | |
1049 } | |
1050 */ | |
1051 | |
1052 //------------------------------------------------------------------------------------------------------------------------------- | |
1053 | |
1054 public void workOutExtensions(){ // calculates whether the performer wants chord extensions | |
1055 if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[3]) | |
1056 tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] = null; | |
1057 if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[2]) | |
1058 tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] = null; | |
1059 if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[1]) | |
1060 tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] = null; | |
1061 if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[0]) | |
1062 tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] = null; | |
1063 | |
1064 if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
1065 heresy7th = true; | |
1066 if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
1067 heresy7th = false; | |
1068 if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
1069 heresy9th = true; | |
1070 if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
1071 heresy9th = false; | |
1072 if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
1073 heresy11th = true; | |
1074 if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
1075 heresy11th = false; | |
1076 if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) | |
1077 heresy13th = true; | |
1078 if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) | |
1079 heresy13th = false; | |
1080 //--- | |
1081 if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[3]) | |
1082 chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] = null; | |
1083 if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[2]) | |
1084 chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] = null; | |
1085 if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[1]) | |
1086 chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] = null; | |
1087 if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[0]) | |
1088 chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] = null; | |
1089 | |
1090 if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
1091 heresy7th = true; | |
1092 if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
1093 heresy7th = false; | |
1094 if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
1095 heresy9th = true; | |
1096 if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
1097 heresy9th = false; | |
1098 if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
1099 heresy11th = true; | |
1100 if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
1101 heresy11th = false; | |
1102 if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) | |
1103 heresy13th = true; | |
1104 if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) | |
1105 heresy13th = false; | |
1106 | |
1107 } | |
1108 | |
1109 | |
1110 //------------------------------------------------------------------------------------------------------------------------------- | |
1111 | |
1112 public void workOutChord(){ // calculates current chord and major minor tonality | |
1113 for (int i = 4; i < 16; i++) { | |
1114 if (tracks[0] != null){ | |
1115 if ((tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)].noteVelocity > 0 )|| | |
1116 (chordsTemp.sequence[i][currentPulse%(tracks[0].loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0 )){ | |
1117 currentChord = 15 - i; | |
1118 boolean iiDone = false; | |
1119 for (int ii = 0;; ii--){ | |
1120 if (ii == 0 && iiDone) | |
1121 break; | |
1122 if (currentPulse%(tracks[0].loopLength)+ii == 0) | |
1123 ii = tracks[0].loopLength+ii-1; | |
1124 if (i > 3){ | |
1125 if ((tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii] != null && tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii].noteVelocity == 0 ) || | |
1126 (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity == 0 )) | |
1127 break; | |
1128 if ((tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii] != null && tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii].noteVelocity != 0 ) || | |
1129 (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity != 0 )){ | |
1130 heresyMinor = true; | |
1131 break; | |
1132 }else | |
1133 heresyMinor = false; | |
1134 } | |
1135 iiDone = true; | |
1136 } | |
1137 } | |
1138 } | |
1139 } | |
1140 } | |
1141 | |
1142 | |
1143 //------------------------------------------------------------------------------------------------------------------------------- | |
1144 | |
1145 public void heresyChangeHistory(){ // remembers whether the chords or extensions have changed | |
1146 if (currentChord != lastChord){ | |
1147 heresyChordChanged = true; | |
1148 lastChord = currentChord; | |
1149 heresyChange = true; | |
1150 } | |
1151 if (heresyMinor != oldHeresyMinor){ | |
1152 heresyMinorChanged = true; | |
1153 oldHeresyMinor = heresyMinor; | |
1154 heresyChange = true; | |
1155 } | |
1156 if (heresy7th != oldHeresy7th){ | |
1157 heresy7thChanged = true; | |
1158 oldHeresy7th = heresy7th; | |
1159 heresyChange = true; | |
1160 } | |
1161 if (heresy9th != oldHeresy9th){ | |
1162 heresy9thChanged = true; | |
1163 oldHeresy9th = heresy9th; | |
1164 heresyChange = true; | |
1165 } | |
1166 if (heresy11th != oldHeresy11th){ | |
1167 heresy11thChanged = true; | |
1168 oldHeresy11th = heresy11th; | |
1169 heresyChange = true; | |
1170 } | |
1171 if (heresy13th != oldHeresy13th){ | |
1172 heresy13thChanged = true; | |
1173 oldHeresy13th = heresy13th; | |
1174 heresyChange = true; | |
1175 } | |
1176 } | |
1177 | |
1178 | |
1179 | |
1180 | |
1181 | |
1182 // the main voicing tables for chords requested | |
1183 | |
1184 // root position | |
1185 | |
1186 int[] hchoice135 = new int[] {24, 36, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 88, 91, 96}; | |
1187 int[] hchoice7 = new int[] {24, 36, 43, 48, 52, 55, 59, 64, 67, 71, 72, 76, 79, 83, 88, 95}; | |
1188 int[] hchoice9 = new int[] {24, 36, 43, 48, 50, 52, 55, 60, 62, 64, 67, 74, 76, 79, 86, 91}; | |
1189 int[] hchoice11 = new int[] {24, 36, 43, 48, 53, 55, 60, 65, 67, 72, 77, 79, 84, 89, 91, 96}; | |
1190 int[] hchoice13 = new int[] {24, 36, 43, 48, 52, 55, 57, 60, 64, 69, 72, 76, 81, 84, 88, 93}; | |
1191 int[] hchoice79 = new int[] {24, 36, 43, 48, 52, 55, 57, 59, 62, 64, 69, 71, 74, 76, 83, 86}; | |
1192 int[] hchoice711 = new int[] {24, 36, 43, 48, 53, 55, 59, 60, 65, 67, 71, 72, 77, 83, 88, 95}; //nice | |
1193 int[] hchoice713 = new int[] {24, 36, 43, 48, 52, 57, 59, 64, 69, 71, 76, 79, 81, 83, 88, 93}; | |
1194 int[] hchoice911 = new int[] {24, 36, 43, 48, 53, 55, 60, 62, 65, 67, 74, 77, 79, 86, 89, 96}; | |
1195 int[] hchoice913 = new int[] {24, 36, 43, 48, 50, 57, 60, 62, 69, 72, 74, 81, 84, 86, 93, 96}; | |
1196 int[] hchoice1113 = new int[] {24, 36, 43, 48, 52, 53, 57, 60, 64, 65, 69, 72, 77, 81, 84, 93}; //nice | |
1197 int[] hchoice7911 = new int[] {24, 36, 43, 48, 55, 62, 65, 71, 77, 79, 83, 84, 86, 89, 91, 96}; | |
1198 int[] hchoice7913 = new int[] {24, 36, 43, 48, 59, 62, 69, 71, 74, 81, 83, 84, 86, 93, 95, 96}; | |
1199 int[] hchoice71113 = new int[]{24, 36, 43, 48, 55, 59, 65, 69, 76, 77, 79, 84, 88, 89, 93, 96}; | |
1200 int[] hchoice91113 = new int[]{24, 36, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89, 96}; | |
1201 int[] hchoice791113 = new int[]{24, 36, 50, 53, 58, 62, 65, 70, 74, 77, 82, 84, 86, 89, 94, 96}; //dom7th full sus chord | |
1202 | |
1203 int[] mhchoice135 = new int[] {24, 36, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 87, 91, 96};// | |
1204 int[] mhchoice7 = new int[] {24, 36, 43, 48, 51, 55, 58, 63, 67, 70, 72, 75, 79, 82, 87, 94};// | |
1205 int[] mhchoice9 = new int[] {24, 36, 43, 48, 50, 51, 55, 60, 62, 63, 67, 72, 74, 79, 86, 91};// | |
1206 int[] mhchoice11 = new int[] {24, 36, 43, 48, 51, 53, 55, 60, 63, 65, 67, 72, 77, 79, 84, 89};// | |
1207 int[] mhchoice13 = new int[] {24, 36, 43, 48, 51, 55, 57, 60, 63, 67, 69, 72, 75, 81, 84, 91};// | |
1208 int[] mhchoice79 = new int[] {24, 36, 43, 50, 51, 55, 57, 58, 62, 63, 69, 70, 74, 75, 82, 86};// | |
1209 int[] mhchoice711 = new int[] {24, 36, 43, 51, 58, 63, 65, 69, 72, 75, 77, 79, 82, 84, 89, 96};// | |
1210 int[] mhchoice713 = new int[] {24, 36, 43, 48, 55, 58, 59, 63, 69, 75, 79, 81, 82, 84, 93, 96};// | |
1211 int[] mhchoice911 = new int[] {24, 36, 43, 48, 51, 53, 62, 63, 65, 67, 74, 77, 79, 86, 89, 96};// | |
1212 int[] mhchoice913 = new int[] {24, 36, 43, 51, 57, 62, 63, 69, 74, 75, 81, 84, 86, 87, 93, 96};// | |
1213 int[] mhchoice1113 = new int[] {24, 36, 43, 53, 57, 63, 67, 72, 75, 77, 79, 81, 84, 87, 93, 96};// | |
1214 int[] mhchoice7911 = new int[] {24, 36, 43, 50, 51, 58, 65, 67, 70, 72, 74, 75, 77, 79, 82, 86};// | |
1215 int[] mhchoice7913 = new int[] {24, 36, 48, 55, 58, 62, 63, 69, 70, 74, 75, 79, 81, 84, 93, 96};// | |
1216 int[] mhchoice71113 = new int[]{24, 36, 43, 48, 53, 58, 63, 65, 69, 72, 75, 77, 81, 84, 91, 96};// | |
1217 int[] mhchoice91113 = new int[]{24, 36, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89, 96};// | |
1218 int[] mhchoice791113 = new int[]{24, 36, 50, 53, 58, 62, 65, 70, 74, 77, 82, 84, 86, 89, 94, 96}; //dom7th full sus chord | |
1219 | |
1220 // first inversion | |
1221 | |
1222 int[] h1choice135 = new int[] {24, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 88, 91}; | |
1223 int[] h1choice7 = new int[] {24, 36, 40, 43, 48, 52, 55, 59, 64, 67, 71, 72, 76, 79, 83, 88}; | |
1224 int[] h1choice9 = new int[] {24, 36, 38, 43, 48, 50, 52, 55, 60, 62, 64, 67, 74, 76, 79, 86}; | |
1225 int[] h1choice11 = new int[] {24, 36, 41, 43, 48, 53, 55, 60, 65, 67, 72, 77, 79, 84, 89, 91}; | |
1226 int[] h1choice13 = new int[] {24, 36, 40, 43, 48, 52, 55, 57, 60, 64, 69, 72, 76, 81, 84, 88}; | |
1227 int[] h1choice79 = new int[] {24, 36, 40, 43, 48, 52, 55, 57, 59, 62, 64, 69, 71, 74, 76, 83}; | |
1228 int[] h1choice711 = new int[] {24, 36, 41, 43, 48, 53, 55, 59, 60, 65, 67, 71, 72, 77, 83, 88}; //nice | |
1229 int[] h1choice713 = new int[] {24, 36, 40, 43, 48, 52, 57, 59, 64, 69, 71, 76, 79, 81, 83, 88}; | |
1230 int[] h1choice911 = new int[] {24, 36, 41, 43, 48, 53, 55, 60, 62, 65, 67, 74, 77, 79, 86, 89}; | |
1231 int[] h1choice913 = new int[] {24, 36, 43, 45, 48, 50, 57, 60, 62, 69, 72, 74, 81, 84, 86, 93}; | |
1232 int[] h1choice1113 = new int[] {24, 36, 40, 43, 48, 52, 53, 57, 60, 64, 65, 69, 72, 77, 81, 84}; //nice | |
1233 int[] h1choice7911 = new int[] {24, 36, 43, 48, 50, 55, 62, 65, 71, 77, 79, 83, 84, 86, 89, 91}; | |
1234 int[] h1choice7913 = new int[] {24, 36, 43, 48, 55, 59, 62, 69, 71, 74, 81, 83, 84, 86, 93, 95}; | |
1235 int[] h1choice71113 = new int[]{24, 36, 43, 48, 53, 55, 59, 65, 69, 76, 77, 79, 84, 88, 89, 93}; | |
1236 int[] h1choice91113 = new int[]{24, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89}; | |
1237 int[] h1choice791113 = new int[]{24, 36, 43, 50, 53, 58, 62, 65, 70, 74, 77, 82, 84, 86, 89, 94}; //dom7th full sus chord | |
1238 | |
1239 int[] m1hchoice135 = new int[] {24, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 87, 91};// | |
1240 int[] m1hchoice7 = new int[] {24, 36, 39, 43, 48, 51, 55, 58, 63, 67, 70, 72, 75, 79, 82, 87};// | |
1241 int[] m1hchoice9 = new int[] {24, 36, 38, 43, 48, 50, 51, 55, 60, 62, 63, 67, 72, 74, 79, 86};// | |
1242 int[] m1hchoice11 = new int[] {24, 36, 39, 43, 48, 51, 53, 55, 60, 63, 65, 67, 72, 77, 79, 84};// | |
1243 int[] m1hchoice13 = new int[] {24, 36, 39, 43, 48, 51, 55, 57, 60, 63, 67, 69, 72, 75, 81, 84};// | |
1244 int[] m1hchoice79 = new int[] {24, 36, 39, 43, 50, 51, 55, 57, 58, 62, 63, 69, 70, 74, 75, 82};// | |
1245 int[] m1hchoice711 = new int[] {24, 36, 43, 46, 51, 58, 63, 65, 69, 72, 75, 77, 79, 82, 84, 89};// | |
1246 int[] m1hchoice713 = new int[] {24, 36, 43, 46, 48, 55, 58, 59, 63, 69, 75, 79, 81, 82, 84, 93};// | |
1247 int[] m1hchoice911 = new int[] {24, 36, 39, 43, 48, 51, 53, 62, 63, 65, 67, 74, 77, 79, 86, 89};// | |
1248 int[] m1hchoice913 = new int[] {24, 36, 43, 48, 51, 57, 62, 63, 69, 74, 75, 81, 84, 86, 87, 93};// | |
1249 int[] m1hchoice1113 = new int[] {24, 36, 43, 45, 53, 57, 63, 67, 72, 75, 77, 79, 81, 84, 87, 93};// | |
1250 int[] m1hchoice7911 = new int[] {24, 36, 39, 43, 50, 51, 58, 65, 67, 70, 72, 74, 75, 77, 79, 82};// | |
1251 int[] m1hchoice7913 = new int[] {24, 36, 43, 48, 55, 58, 62, 63, 69, 70, 74, 75, 79, 81, 84, 93};// | |
1252 int[] m1hchoice71113 = new int[]{24, 36, 43, 46, 48, 53, 58, 63, 65, 69, 72, 75, 77, 81, 84, 91};// | |
1253 int[] m1hchoice91113 = new int[]{24, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89};// | |
1254 int[] m1hchoice791113 = new int[]{24, 36, 46, 50, 53, 58, 62, 65, 70, 74, 77, 82, 84, 86, 89, 94}; //dom7th full sus chord | |
1255 | |
1256 // second inversion | |
1257 | |
1258 int[] h2choice135 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 88}; | |
1259 int[] h2choice7 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 59, 64, 67, 71, 72, 76, 79, 83}; | |
1260 int[] h2choice9 = new int[] {24, 31, 36, 38, 43, 48, 50, 52, 55, 60, 62, 64, 67, 74, 76, 79}; | |
1261 int[] h2choice11 = new int[] {24, 31, 36, 41, 43, 48, 53, 55, 60, 65, 67, 72, 77, 79, 84, 89}; | |
1262 int[] h2choice13 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 57, 60, 64, 69, 72, 76, 81, 84}; | |
1263 int[] h2choice79 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 57, 59, 62, 64, 69, 71, 74, 76}; | |
1264 int[] h2choice711 = new int[] {24, 31, 36, 41, 43, 48, 53, 55, 59, 60, 65, 67, 71, 72, 77, 83}; //nice | |
1265 int[] h2choice713 = new int[] {24, 31, 36, 40, 43, 48, 52, 57, 59, 64, 69, 71, 76, 79, 81, 83}; | |
1266 int[] h2choice911 = new int[] {24, 31, 36, 41, 43, 48, 53, 55, 60, 62, 65, 67, 74, 77, 79, 86}; | |
1267 int[] h2choice913 = new int[] {24, 31, 36, 43, 45, 48, 50, 57, 60, 62, 69, 72, 74, 81, 84, 86}; | |
1268 int[] h2choice1113 = new int[] {24, 31, 36, 40, 43, 48, 52, 53, 57, 60, 64, 65, 69, 72, 77, 81}; //nice | |
1269 int[] h2choice7911 = new int[] {24, 31, 36, 43, 48, 50, 55, 62, 65, 71, 77, 79, 83, 84, 86, 89}; | |
1270 int[] h2choice7913 = new int[] {24, 31, 36, 43, 48, 55, 59, 62, 69, 71, 74, 81, 83, 84, 86, 93}; | |
1271 int[] h2choice71113 = new int[]{24, 31, 36, 43, 48, 53, 55, 59, 65, 69, 76, 77, 79, 84, 88, 89}; | |
1272 int[] h2choice91113 = new int[]{24, 31, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81}; | |
1273 int[] h2choice791113 = new int[]{24, 31, 36, 43, 50, 53, 58, 62, 65, 70, 74, 77, 82, 84, 86, 89}; //dom7th full sus chord | |
1274 | |
1275 int[] m2hchoice135 = new int[] {24, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 87};// | |
1276 int[] m2hchoice7 = new int[] {24, 31, 36, 39, 43, 48, 51, 55, 58, 63, 67, 70, 72, 75, 79, 82};// | |
1277 int[] m2hchoice9 = new int[] {24, 31, 36, 38, 43, 48, 50, 51, 55, 60, 62, 63, 67, 72, 74, 79};// | |
1278 int[] m2hchoice11 = new int[] {24, 31, 36, 39, 43, 48, 51, 53, 55, 60, 63, 65, 67, 72, 77, 79};// | |
1279 int[] m2hchoice13 = new int[] {24, 31, 36, 39, 43, 48, 51, 55, 57, 60, 63, 67, 69, 72, 75, 81};// | |
1280 int[] m2hchoice79 = new int[] {24, 31, 36, 39, 43, 50, 51, 55, 57, 58, 62, 63, 69, 70, 74, 75};// | |
1281 int[] m2hchoice711 = new int[] {24, 31, 36, 43, 46, 51, 58, 63, 65, 69, 72, 75, 77, 79, 82, 84};// | |
1282 int[] m2hchoice713 = new int[] {24, 31, 36, 43, 46, 48, 55, 58, 59, 63, 69, 75, 79, 81, 82, 84};// | |
1283 int[] m2hchoice911 = new int[] {24, 31, 36, 39, 43, 48, 51, 53, 62, 63, 65, 67, 74, 77, 79, 86};// | |
1284 int[] m2hchoice913 = new int[] {24, 31, 36, 43, 48, 51, 57, 62, 63, 69, 74, 75, 81, 84, 86, 87};// | |
1285 int[] m2hchoice1113 = new int[] {24, 31, 36, 43, 45, 53, 57, 63, 67, 72, 75, 77, 79, 81, 84, 87};// | |
1286 int[] m2hchoice7911 = new int[] {24, 31, 36, 39, 43, 50, 51, 58, 65, 67, 70, 72, 74, 75, 77, 79};// | |
1287 int[] m2hchoice7913 = new int[] {24, 31, 36, 43, 48, 55, 58, 62, 63, 69, 70, 74, 75, 79, 81, 84};// | |
1288 int[] m2hchoice71113 = new int[]{24, 31, 36, 43, 46, 48, 53, 58, 63, 65, 69, 72, 75, 77, 81, 84};// | |
1289 int[] m2hchoice91113 = new int[]{24, 31, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81};// | |
1290 int[] m2hchoice791113 = new int[]{24, 31, 36, 46, 50, 53, 58, 62, 65, 70, 74, 77, 82, 84, 86, 89}; //dom7th full sus chord | |
1291 | |
1292 int[] hvArray; | |
1293 int[] minorSystem = new int[] {0, 3, 7, 10, 14, 17, 21}; | |
1294 int[] major7System = new int[] {0, 4, 7, 11, 14, 18, 21}; | |
1295 int[] dom7System = new int[] {0, 4, 7, 10, 14, 17, 21}; | |
1296 int[] tritoneSystem = new int[] {0, 4, 7, 10, 14, 18, 21}; | |
1297 | |
1298 public int heresyPitch(int arrayPosition, int heresyChannel){ // calculates the pitch value to be returned for playback. | |
1299 boolean m = heresyMinor; | |
1300 boolean e7 = heresy7th; | |
1301 boolean e9 = heresy9th; | |
1302 boolean e11 = heresy11th; | |
1303 boolean e13 = heresy13th; | |
1304 int returnInt = 0; | |
1305 if ((currentChord % 12) > -1 && (currentChord % 12) < 4){ | |
1306 if (!m && !e7 && !e9 && !e11 && !e13) returnInt = hchoice135[15 - arrayPosition]; | |
1307 if (!m && e7 && !e9 && !e11 && !e13) returnInt = hchoice7[15 - arrayPosition]; | |
1308 if (!m && !e7 && e9 && !e11 && !e13) returnInt = hchoice9[15 - arrayPosition]; | |
1309 if (!m && !e7 && !e9 && e11 && !e13) returnInt = hchoice11[15 - arrayPosition]; | |
1310 if (!m && !e7 && !e9 && !e11 && e13) returnInt = hchoice13[15 - arrayPosition]; | |
1311 if (!m && e7 && e9 && !e11 && !e13) returnInt = hchoice79[15 - arrayPosition]; | |
1312 if (!m && e7 && !e9 && e11 && !e13) returnInt = hchoice711[15 - arrayPosition]; | |
1313 if (!m && e7 && !e9 && !e11 && e13) returnInt = hchoice713[15 - arrayPosition]; | |
1314 if (!m && !e7 && e9 && e11 && !e13) returnInt = hchoice911[15 - arrayPosition]; | |
1315 if (!m && !e7 && e9 && !e11 && e13) returnInt = hchoice913[15 - arrayPosition]; | |
1316 if (!m && !e7 && !e9 && e11 && e13) returnInt = hchoice1113[15 - arrayPosition]; | |
1317 if (!m && e7 && e9 && e11 && !e13) returnInt = hchoice7911[15 - arrayPosition]; | |
1318 if (!m && e7 && e9 && !e11 && e13) returnInt = hchoice7913[15 - arrayPosition]; | |
1319 if (!m && e7 && !e9 && e11 && e13) returnInt = hchoice71113[15 - arrayPosition]; | |
1320 if (!m && !e7 && e9 && e11 && e13) returnInt = hchoice91113[15 - arrayPosition]; | |
1321 if (!m && e7 && e9 && e11 && e13) returnInt = hchoice791113[15 - arrayPosition]; | |
1322 | |
1323 if (m && !e7 && !e9 && !e11 && !e13) returnInt = mhchoice135[15 - arrayPosition]; | |
1324 if (m && e7 && !e9 && !e11 && !e13) returnInt = mhchoice7[15 - arrayPosition]; | |
1325 if (m && !e7 && e9 && !e11 && !e13) returnInt = mhchoice9[15 - arrayPosition]; | |
1326 if (m && !e7 && !e9 && e11 && !e13) returnInt = mhchoice11[15 - arrayPosition]; | |
1327 if (m && !e7 && !e9 && !e11 && e13) returnInt = mhchoice13[15 - arrayPosition]; | |
1328 if (m && e7 && e9 && !e11 && !e13) returnInt = mhchoice79[15 - arrayPosition]; | |
1329 if (m && e7 && !e9 && e11 && !e13) returnInt = mhchoice711[15 - arrayPosition]; | |
1330 if (m && e7 && !e9 && !e11 && e13) returnInt = mhchoice713[15 - arrayPosition]; | |
1331 if (m && !e7 && e9 && e11 && !e13) returnInt = mhchoice911[15 - arrayPosition]; | |
1332 if (m && !e7 && e9 && !e11 && e13) returnInt = mhchoice913[15 - arrayPosition]; | |
1333 if (m && !e7 && !e9 && e11 && e13) returnInt = mhchoice1113[15 - arrayPosition]; | |
1334 if (m && e7 && e9 && e11 && !e13) returnInt = mhchoice7911[15 - arrayPosition]; | |
1335 if (m && e7 && e9 && !e11 && e13) returnInt = mhchoice7913[15 - arrayPosition]; | |
1336 if (m && e7 && !e9 && e11 && e13) returnInt = mhchoice71113[15 - arrayPosition]; | |
1337 if (m && !e7 && e9 && e11 && e13) returnInt = mhchoice91113[15 - arrayPosition]; | |
1338 if (m && e7 && e9 && e11 && e13) returnInt = mhchoice791113[15 - arrayPosition]; | |
1339 } | |
1340 | |
1341 if ((currentChord % 12) > 3 && (currentChord % 12) < 8){ | |
1342 if (!m && !e7 && !e9 && !e11 && !e13) returnInt = h1choice135[15 - arrayPosition]; | |
1343 if (!m && e7 && !e9 && !e11 && !e13) returnInt = h1choice7[15 - arrayPosition]; | |
1344 if (!m && !e7 && e9 && !e11 && !e13) returnInt = h1choice9[15 - arrayPosition]; | |
1345 if (!m && !e7 && !e9 && e11 && !e13) returnInt = h1choice11[15 - arrayPosition]; | |
1346 if (!m && !e7 && !e9 && !e11 && e13) returnInt = h1choice13[15 - arrayPosition]; | |
1347 if (!m && e7 && e9 && !e11 && !e13) returnInt = h1choice79[15 - arrayPosition]; | |
1348 if (!m && e7 && !e9 && e11 && !e13) returnInt = h1choice711[15 - arrayPosition]; | |
1349 if (!m && e7 && !e9 && !e11 && e13) returnInt = h1choice713[15 - arrayPosition]; | |
1350 if (!m && !e7 && e9 && e11 && !e13) returnInt = h1choice911[15 - arrayPosition]; | |
1351 if (!m && !e7 && e9 && !e11 && e13) returnInt = h1choice913[15 - arrayPosition]; | |
1352 if (!m && !e7 && !e9 && e11 && e13) returnInt = h1choice1113[15 - arrayPosition]; | |
1353 if (!m && e7 && e9 && e11 && !e13) returnInt = h1choice7911[15 - arrayPosition]; | |
1354 if (!m && e7 && e9 && !e11 && e13) returnInt = h1choice7913[15 - arrayPosition]; | |
1355 if (!m && e7 && !e9 && e11 && e13) returnInt = h1choice71113[15 - arrayPosition]; | |
1356 if (!m && !e7 && e9 && e11 && e13) returnInt = h1choice91113[15 - arrayPosition]; | |
1357 if (!m && e7 && e9 && e11 && e13) returnInt = h1choice791113[15 - arrayPosition]; | |
1358 | |
1359 if (m && !e7 && !e9 && !e11 && !e13) returnInt = m1hchoice135[15 - arrayPosition]; | |
1360 if (m && e7 && !e9 && !e11 && !e13) returnInt = m1hchoice7[15 - arrayPosition]; | |
1361 if (m && !e7 && e9 && !e11 && !e13) returnInt = m1hchoice9[15 - arrayPosition]; | |
1362 if (m && !e7 && !e9 && e11 && !e13) returnInt = m1hchoice11[15 - arrayPosition]; | |
1363 if (m && !e7 && !e9 && !e11 && e13) returnInt = m1hchoice13[15 - arrayPosition]; | |
1364 if (m && e7 && e9 && !e11 && !e13) returnInt = m1hchoice79[15 - arrayPosition]; | |
1365 if (m && e7 && !e9 && e11 && !e13) returnInt = m1hchoice711[15 - arrayPosition]; | |
1366 if (m && e7 && !e9 && !e11 && e13) returnInt = m1hchoice713[15 - arrayPosition]; | |
1367 if (m && !e7 && e9 && e11 && !e13) returnInt = m1hchoice911[15 - arrayPosition]; | |
1368 if (m && !e7 && e9 && !e11 && e13) returnInt = m1hchoice913[15 - arrayPosition]; | |
1369 if (m && !e7 && !e9 && e11 && e13) returnInt = m1hchoice1113[15 - arrayPosition]; | |
1370 if (m && e7 && e9 && e11 && !e13) returnInt = m1hchoice7911[15 - arrayPosition]; | |
1371 if (m && e7 && e9 && !e11 && e13) returnInt = m1hchoice7913[15 - arrayPosition]; | |
1372 if (m && e7 && !e9 && e11 && e13) returnInt = m1hchoice71113[15 - arrayPosition]; | |
1373 if (m && !e7 && e9 && e11 && e13) returnInt = m1hchoice91113[15 - arrayPosition]; | |
1374 if (m && e7 && e9 && e11 && e13) returnInt = m1hchoice791113[15 - arrayPosition]; | |
1375 } | |
1376 | |
1377 if ((currentChord % 12) > 7 && (currentChord % 12) < 12){ | |
1378 if (!m && !e7 && !e9 && !e11 && !e13) returnInt = h2choice135[15 - arrayPosition]; | |
1379 if (!m && e7 && !e9 && !e11 && !e13) returnInt = h2choice7[15 - arrayPosition]; | |
1380 if (!m && !e7 && e9 && !e11 && !e13) returnInt = h2choice9[15 - arrayPosition]; | |
1381 if (!m && !e7 && !e9 && e11 && !e13) returnInt = h2choice11[15 - arrayPosition]; | |
1382 if (!m && !e7 && !e9 && !e11 && e13) returnInt = h2choice13[15 - arrayPosition]; | |
1383 if (!m && e7 && e9 && !e11 && !e13) returnInt = h2choice79[15 - arrayPosition]; | |
1384 if (!m && e7 && !e9 && e11 && !e13) returnInt = h2choice711[15 - arrayPosition]; | |
1385 if (!m && e7 && !e9 && !e11 && e13) returnInt = h2choice713[15 - arrayPosition]; | |
1386 if (!m && !e7 && e9 && e11 && !e13) returnInt = h2choice911[15 - arrayPosition]; | |
1387 if (!m && !e7 && e9 && !e11 && e13) returnInt = h2choice913[15 - arrayPosition]; | |
1388 if (!m && !e7 && !e9 && e11 && e13) returnInt = h2choice1113[15 - arrayPosition]; | |
1389 if (!m && e7 && e9 && e11 && !e13) returnInt = h2choice7911[15 - arrayPosition]; | |
1390 if (!m && e7 && e9 && !e11 && e13) returnInt = h2choice7913[15 - arrayPosition]; | |
1391 if (!m && e7 && !e9 && e11 && e13) returnInt = h2choice71113[15 - arrayPosition]; | |
1392 if (!m && !e7 && e9 && e11 && e13) returnInt = h2choice91113[15 - arrayPosition]; | |
1393 if (!m && e7 && e9 && e11 && e13) returnInt = h2choice791113[15 - arrayPosition]; | |
1394 | |
1395 if (m && !e7 && !e9 && !e11 && !e13) returnInt = m2hchoice135[15 - arrayPosition]; | |
1396 if (m && e7 && !e9 && !e11 && !e13) returnInt = m2hchoice7[15 - arrayPosition]; | |
1397 if (m && !e7 && e9 && !e11 && !e13) returnInt = m2hchoice9[15 - arrayPosition]; | |
1398 if (m && !e7 && !e9 && e11 && !e13) returnInt = m2hchoice11[15 - arrayPosition]; | |
1399 if (m && !e7 && !e9 && !e11 && e13) returnInt = m2hchoice13[15 - arrayPosition]; | |
1400 if (m && e7 && e9 && !e11 && !e13) returnInt = m2hchoice79[15 - arrayPosition]; | |
1401 if (m && e7 && !e9 && e11 && !e13) returnInt = m2hchoice711[15 - arrayPosition]; | |
1402 if (m && e7 && !e9 && !e11 && e13) returnInt = m2hchoice713[15 - arrayPosition]; | |
1403 if (m && !e7 && e9 && e11 && !e13) returnInt = m2hchoice911[15 - arrayPosition]; | |
1404 if (m && !e7 && e9 && !e11 && e13) returnInt = m2hchoice913[15 - arrayPosition]; | |
1405 if (m && !e7 && !e9 && e11 && e13) returnInt = m2hchoice1113[15 - arrayPosition]; | |
1406 if (m && e7 && e9 && e11 && !e13) returnInt = m2hchoice7911[15 - arrayPosition]; | |
1407 if (m && e7 && e9 && !e11 && e13) returnInt = m2hchoice7913[15 - arrayPosition]; | |
1408 if (m && e7 && !e9 && e11 && e13) returnInt = m2hchoice71113[15 - arrayPosition]; | |
1409 if (m && !e7 && e9 && e11 && e13) returnInt = m2hchoice91113[15 - arrayPosition]; | |
1410 if (m && e7 && e9 && e11 && e13) returnInt = m2hchoice791113[15 - arrayPosition]; | |
1411 } | |
1412 | |
1413 if (heresyDom && returnInt % 12 == 11) | |
1414 returnInt--; | |
1415 returnInt = currentChord + returnInt; | |
1416 | |
1417 // if (heresyChannel == 1 || heresyChannel == 5) | |
1418 // returnInt = 15 - arrayPosition + 36; | |
1419 | |
1420 | |
1421 | |
1422 return returnInt; | |
1423 } | |
1424 | |
1425 | |
1426 public void sendNote(VPNote note, int channel){ // send note function gathers info to output to max | |
1427 outputToMax(note.VPNotePitch, note.VPNoteVelocity, channel); | |
1428 } | |
1429 | |
1430 | |
1431 //------------------------------------------------------------------------------------------------------------------------------- | |
1432 | |
1433 public void outputToMax(int note, int velocity, int channel){ // calculates the necessary note on and note offs depending on ducking and muting and sends them to max | |
1434 String noteOut = ""; | |
1435 if (!tracks[channel].mute){ | |
1436 if (tracks[channel].ducking){ | |
1437 if (velocity != 0){ | |
1438 noteOut = ("" + note + " " + velocity + " " + (channel+8)); | |
1439 } | |
1440 if (velocity == 0 && !tracks[channel].cycled){ | |
1441 noteOut = ("" + note + " " + velocity + " " + (channel+8)); | |
1442 OscMessage message = new OscMessage("/pitch_vel_chan"); | |
1443 message.add(noteOut); | |
1444 oscP5return.send(message, ableton); | |
1445 link.output(noteOut); | |
1446 noteOut = ("" + note + " " + velocity + " " + channel); | |
1447 } | |
1448 if (velocity == 0 && tracks[channel].cycled){ | |
1449 noteOut = ("" + note + " " + velocity + " " + (channel+8)); | |
1450 } | |
1451 } | |
1452 if (!tracks[channel].ducking){ | |
1453 if (velocity != 0){ | |
1454 noteOut = ("" + note + " " + velocity + " " + channel); | |
1455 } | |
1456 if (velocity == 0 && !tracks[channel].cycled){ | |
1457 noteOut = ("" + note + " " + velocity + " " + (channel+8)); | |
1458 OscMessage message = new OscMessage("/pitch_vel_chan"); | |
1459 message.add(noteOut); | |
1460 oscP5return.send(message, ableton); | |
1461 link.output(noteOut); | |
1462 noteOut = ("" + note + " " + velocity + " " + channel); | |
1463 } | |
1464 if (velocity == 0 && tracks[channel].cycled){ | |
1465 noteOut = ("" + note + " " + velocity + " " + channel); | |
1466 } | |
1467 } | |
1468 link.output(noteOut); | |
1469 OscMessage message = new OscMessage("/pitch_vel_chan"); | |
1470 message.add(noteOut); | |
1471 oscP5return.send(message, ableton); | |
1472 | |
1473 } | |
1474 if (tracks[channel].mute){ | |
1475 if (velocity == 0 && !tracks[channel].cycled){ | |
1476 noteOut = ("" + note + " " + velocity + " " + (channel+8)); | |
1477 link.output(noteOut); | |
1478 OscMessage message = new OscMessage("/pitch_vel_chan"); | |
1479 message.add(noteOut); | |
1480 oscP5return.send(message, ableton); | |
1481 noteOut = ("" + note + " " + velocity + " " + channel); | |
1482 OscMessage message2 = new OscMessage("/pitch_vel_chan"); | |
1483 message2.add(noteOut); | |
1484 oscP5return.send(message, ableton); | |
1485 link.output(noteOut); | |
1486 } | |
1487 } | |
1488 } | |
1489 | |
1490 | |
1491 //------------------------------------------------------------------------------------------------------------------------------- | |
1492 | |
1493 public void mouseDragged(){ // not used | |
1494 } | |
1495 | |
1496 | |
1497 //------------------------------------------------------------------------------------------------------------------------------- | |
1498 | |
1499 public void mouseReleased(){ // not used | |
1500 } | |
1501 | |
1502 | |
1503 //------------------------------------------------------------------------------------------------------------------------------- | |
1504 | |
1505 public void mousePressed(){ // not used | |
1506 } | |
1507 | |
1508 | |
1509 //------------------------------------------------------------------------------------------------------------------------------- | |
1510 | |
1511 public void keyPressed() { // takes keyboard input | |
1512 if (key == 'c' || key == 'C') { | |
1513 chordSelecter = !chordSelecter; | |
1514 if (!chordSelecter) | |
1515 trSelected = lastTrack; | |
1516 else{ | |
1517 lastTrack = trSelected; | |
1518 trSelected = 0; | |
1519 | |
1520 } | |
1521 } | |
1522 | |
1523 if (key == ' ') { | |
1524 if (trSelected != 0){ | |
1525 for (int i = 0; i < 16; i++){ | |
1526 noteOnArray[i] = false; | |
1527 finishNote(i); | |
1528 displayNoteOnArray[i] = false; | |
1529 } | |
1530 | |
1531 if (trSelected != 0){ | |
1532 for (int i = 24; i < 109; i++) | |
1533 outputToMax(i, 0, trSelected); | |
1534 } | |
1535 tracks[trSelected] = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); | |
1536 imgNotes = null; | |
1537 } | |
1538 | |
1539 if (trSelected == 0){ | |
1540 for (int i = 0; i < 16; i++){ | |
1541 noteOnArray[i] = false; | |
1542 finishNote(i); | |
1543 displayNoteOnArray[i] = false; | |
1544 } | |
1545 heresyMinor = false; | |
1546 heresy7th = false; | |
1547 heresy9th = false; | |
1548 heresy11th = false; | |
1549 heresy13th = false; | |
1550 chordsTemp = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); | |
1551 imgNotes = null; | |
1552 } | |
1553 } | |
1554 | |
1555 if (key == 'p' || key == 'P') { | |
1556 for (int i = 0; i < 16; i++){ | |
1557 for (int ii = 24; ii < 109; ii++) | |
1558 outputToMax(ii, 0, trSelected); | |
1559 noteOnArray[i] = false; | |
1560 displayNoteOnArray[i] = false; | |
1561 } | |
1562 } | |
1563 | |
1564 if (key == 'd' || key == 'D') { | |
1565 if (trSelected != 0 && trSelected != 1){ | |
1566 tracks[trSelected].ducking = !tracks[trSelected].ducking; | |
1567 tracks[trSelected].cycled = false; | |
1568 tracks[trSelected].cycledPosition = currentPulse%tracks[trSelected].loopLength; | |
1569 } | |
1570 } | |
1571 | |
1572 if (key == 'w' || key == 'W') { | |
1573 | |
1574 trSelected = 0; | |
1575 | |
1576 for (int i = 0; i < 16; i++){ | |
1577 noteOnArray[i] = false; | |
1578 finishNoteCutOff(i); | |
1579 displayNoteOnArray[i] = false; | |
1580 } | |
1581 heresyMinor = false; | |
1582 heresy7th = false; | |
1583 heresy9th = false; | |
1584 heresy11th = false; | |
1585 heresy13th = false; | |
1586 | |
1587 tracks[trSelected] = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); | |
1588 chordsTemp = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); | |
1589 imgNotes = null; | |
1590 } | |
1591 | |
1592 if (key == 'q' || key == 'Q'){ | |
1593 quantizeValueIn = true; | |
1594 sendToScreen(tracks[trSelected].name + " quantize?"); | |
1595 } | |
1596 | |
1597 if (key == 'x' || key == 'X'){ | |
1598 clickTrackOn = !clickTrackOn; | |
1599 } | |
1600 | |
1601 if (key == 'e' || key == 'E'){ | |
1602 eraseOn = !eraseOn; | |
1603 if (!eraseOn) imgNotes = null; | |
1604 } | |
1605 | |
1606 if (key == 'r' || key == 'R'){ | |
1607 imgNotes = null; | |
1608 } | |
1609 | |
1610 if (key == 'l' || key == 'L'){ | |
1611 loopLengthValueIn = true; | |
1612 sendToScreen(tracks[trSelected].name + " loop length?"); | |
1613 } | |
1614 | |
1615 if (key == 'm' || key == 'M'){ | |
1616 if (trSelected != 0){ | |
1617 muteValueIn = true; | |
1618 if (!tracks[trSelected].mute) | |
1619 sendToScreen(tracks[trSelected].name + " mute in?"); | |
1620 if (tracks[trSelected].mute) | |
1621 sendToScreen(tracks[trSelected].name + " unmute in?"); | |
1622 } | |
1623 } | |
1624 | |
1625 | |
1626 if (key == '1') numberKey(1); | |
1627 if (key == '2') numberKey(2); | |
1628 if (key == '3') numberKey(3); | |
1629 if (key == '4') numberKey(4); | |
1630 if (key == '5') numberKey(5); | |
1631 if (key == '6') numberKey(6); | |
1632 if (key == '7') numberKey(7); | |
1633 if (key == '8') numberKey(8); | |
1634 if (key == '9') numberKey(9); | |
1635 if (key == '0') numberKey(0); | |
1636 | |
1637 if (key == CODED) { | |
1638 if (keyCode == UP && trSelected < Track.currentNumberOfTracks-1) | |
1639 trSelected++; | |
1640 if (keyCode == DOWN && trSelected > 1) { | |
1641 trSelected--; | |
1642 } | |
1643 } | |
1644 | |
1645 if (key == 's' || key == 'S'){ | |
1646 for (int i = 0; i < 16; i++){ | |
1647 for (int ii = 0; ii < tracks[0].loopLength; ii++){ | |
1648 if (chordsTemp.sequence[i][ii] != null) | |
1649 tracks[0].sequence[i][ii] = chordsTemp.sequence[i][ii]; | |
1650 } | |
1651 } | |
1652 } | |
1653 | |
1654 | |
1655 } | |
1656 | |
1657 | |
1658 //------------------------------------------------------------------------------------------------------------------------------- | |
1659 | |
1660 public void numberKey(int input){ // if a number is enterd, this method works out what to do with it | |
1661 if (quantizeValueIn == true) | |
1662 if (input == 1 || input == 2 || input == 4 || input == 8 || input == 0){ | |
1663 tracks[trSelected].quantize = input; | |
1664 quantizeValueIn = false; | |
1665 aniOut = true; | |
1666 } | |
1667 | |
1668 if (loopLengthValueIn == true){ | |
1669 if (input >= 1 && input <= 8 ){ | |
1670 Track tempTrack = new Track(tracks[trSelected].name, tracks[trSelected].polyphonic, (input * loopLength / 2), tracks[trSelected].quantize, false, false); | |
1671 NoteEvent tempNote; | |
1672 | |
1673 for (int i = 0; i < 16; i++){ | |
1674 if (tempTrack.loopLength >= tracks[trSelected].loopLength){ | |
1675 for (int ii = 0; ii < tracks[trSelected].loopLength; ii++){ | |
1676 tempTrack.sequence[i][ii] = tracks[trSelected].sequence[i][ii]; | |
1677 } | |
1678 }else{ | |
1679 for (int ii = 0; ii < tempTrack.loopLength; ii++){ | |
1680 tempTrack.sequence[i][ii] = tracks[trSelected].sequence[i][ii]; | |
1681 } | |
1682 } | |
1683 } | |
1684 tracks[trSelected] = tempTrack; | |
1685 for (int i = 0; i < 16; i++) | |
1686 if (noteOnArray[i] = true){ | |
1687 noteOnArray[i] = false; | |
1688 finishNoteCutOff(i); | |
1689 displayNoteOnArray[i] = false; | |
1690 } | |
1691 | |
1692 | |
1693 loopLengthValueIn = false; | |
1694 aniOut = true; | |
1695 if (trSelected ==0){ | |
1696 Track tempTrack2 = new Track(chordsTemp.name, chordsTemp.polyphonic, (input * loopLength / 2), chordsTemp.quantize, false, false); | |
1697 NoteEvent tempNote2; | |
1698 | |
1699 for (int i = 0; i < 16; i++){ | |
1700 if (tempTrack2.loopLength >= chordsTemp.loopLength){ | |
1701 for (int ii = 0; ii < chordsTemp.loopLength; ii++){ | |
1702 tempTrack2.sequence[i][ii] = chordsTemp.sequence[i][ii]; | |
1703 } | |
1704 }else{ | |
1705 for (int ii = 0; ii < tempTrack2.loopLength; ii++){ | |
1706 tempTrack2.sequence[i][ii] = chordsTemp.sequence[i][ii]; | |
1707 } | |
1708 } | |
1709 } | |
1710 chordsTemp = tempTrack2; | |
1711 } | |
1712 imgNotes = null; | |
1713 } | |
1714 } | |
1715 | |
1716 if (muteValueIn == true){ | |
1717 tracks[trSelected].muteIn = bar + input; | |
1718 muteValueIn = false; | |
1719 tracks[trSelected].muteDone = false; | |
1720 aniOut = true; | |
1721 } | |
1722 | |
1723 | |
1724 } | |
1725 | |
1726 | |
1727 //------------------------------------------------------------------------------------------------------------------------------- | |
1728 | |
1729 public void sendToScreen(String name){ // prepares a question for asking the user and turns the question on | |
1730 | |
1731 screenQuestion = name; | |
1732 screenAni = 0; | |
1733 haveQuestion = true; | |
1734 | |
1735 } | |
1736 | |
1737 | |
1738 //------------------------------------------------------------------------------------------------------------------------------- | |
1739 | |
1740 public void checkCycled(){ // checks whether after ducking or muting all note offs are played. | |
1741 for (int i = 1; i < Track.currentNumberOfTracks; i++) | |
1742 if (tracks[i].cycled == false) | |
1743 if (tracks[i].cycledPosition-1 == currentPulse%tracks[trSelected].loopLength) | |
1744 tracks[i].cycled = true; | |
1745 | |
1746 } | |
1747 | |
1748 | |
1749 //------------------------------------------------------------------------------------------------------------------------------- | |
1750 | |
1751 | |
1752 public void checkForMutes(){ // looks for mute / unmuted changes in tracks | |
1753 for (int i = 1; i < Track.currentNumberOfTracks; i++) | |
1754 if (tracks[i].muteIn == bar && !tracks[i].muteDone){ | |
1755 tracks[i].mute = !tracks[i].mute; | |
1756 tracks[i].muteDone = true; | |
1757 tracks[trSelected].cycled = false; | |
1758 tracks[trSelected].cycledPosition = currentPulse%tracks[trSelected].loopLength; | |
1759 } | |
1760 } | |
1761 | |
1762 | |
1763 | |
1764 //------------------------------------------------------------------------------------------------------------------------------- | |
1765 | |
1766 public void writeQuestion(){ // animates screen questions | |
1767 | |
1768 if (screenAni < 10 && !aniOut){ | |
1769 screenAni++; | |
1770 } | |
1771 | |
1772 if (screenAni > 0 && aniOut){ | |
1773 screenAni--; | |
1774 } | |
1775 | |
1776 if (screenAni == 0){ | |
1777 haveQuestion = false; | |
1778 aniOut = false; | |
1779 } | |
1780 | |
1781 fill(255,0,0, screenAni*12); | |
1782 textSize((11-screenAni)*40); | |
1783 text(screenQuestion, (screenAni*50)-200,(100-screenAni*10)+150); | |
1784 | |
1785 | |
1786 } | |
1787 | |
1788 | |
1789 //------------------------------------------------------------------------------------------------------------------------------- | |
1790 | |
1791 public void oscEvent(OscMessage theOscMessage) { // recieves osc messages from openFrameworks | |
1792 println("osc message : " + theOscMessage); | |
1793 if(theOscMessage.checkAddrPattern("/test")==true) { | |
1794 println("i1 : " + theOscMessage.get(1).intValue() + " i2 : " + theOscMessage.get(2).intValue() + " i3 : " + theOscMessage.get(3).intValue() + " i4 : " + theOscMessage.get(4).intValue()); | |
1795 clickTrack = false; | |
1796 String stringValue = theOscMessage.get(0).stringValue(); | |
1797 int firstValue = theOscMessage.get(1).intValue(); | |
1798 int secondValue = theOscMessage.get(2).intValue(); | |
1799 int thirdValue = theOscMessage.get(3).intValue(); //velocity | |
1800 int fourthValue = theOscMessage.get(4).intValue(); //channel | |
1801 if (secondValue == 1){ | |
1802 noteOnArray[firstValue] = true; | |
1803 writeNote(firstValue, thirdValue, fourthValue); | |
1804 } | |
1805 else{ | |
1806 noteOnArray[firstValue] = false; | |
1807 writeNote(firstValue, 0, fourthValue); | |
1808 } | |
1809 } | |
1810 if(theOscMessage.checkAddrPattern("/chord")==true) { | |
1811 chordCalc(); | |
1812 // writeNote(15, 80, 6); | |
1813 writeNote(14, 80, 6); | |
1814 writeNote(13, 80, 6); | |
1815 writeNote(12, 80, 6); | |
1816 writeNote(11, 80, 6); | |
1817 writeNote(10, 80, 6); | |
1818 writeNote(9, 80, 6); | |
1819 } | |
1820 } | |
1821 | |
1822 | |
1823 | |
1824 class VPArray{ // the virtual playing array for Heresy AI to play with | |
1825 | |
1826 VPNote[] VPArrayNotes; | |
1827 | |
1828 public VPArray(){ | |
1829 VPArrayNotes = new VPNote[16]; | |
1830 for (int i = 0; i < 16; i++) | |
1831 VPArrayNotes[i] = new VPNote(); | |
1832 } | |
1833 } | |
1834 | |
1835 class VPNote{ | |
1836 | |
1837 boolean played; | |
1838 boolean VPNoteOn; | |
1839 boolean done; | |
1840 int extension; | |
1841 int VPNotePitch; | |
1842 int VPNoteVelocity; | |
1843 | |
1844 public VPNote(){ | |
1845 VPNoteOn = false; | |
1846 played = true; | |
1847 extension = 0; | |
1848 VPNotePitch = 0; | |
1849 VPNoteVelocity = 0; | |
1850 } | |
1851 } | |
1852 | |
1853 | |
1854 | |
1855 | |
1856 public void chordCalc(){ | |
1857 barCounter++; | |
1858 if (barCounter % 4 == 0 || ((currentChord == 1 || currentChord == 5 || currentChord == 7) && barCounter % 4 == 3)){ | |
1859 tonicNeeded = true; | |
1860 print(" tonic needed " + (barCounter % 4)); | |
1861 } | |
1862 else tonicNeeded = false; | |
1863 chooseChord(); | |
1864 } | |
1865 | |
1866 public void chooseChord(){ | |
1867 | |
1868 int i = 0; | |
1869 for (; i < crneeded; i++){ | |
1870 if (chordChoicesArray[i].chordNote == currentChord && chordChoicesArray[i].minor == heresyMinor) | |
1871 break; | |
1872 } | |
1873 if (currentChord == 1 && heresyDom) | |
1874 i = 16; | |
1875 if (tonicNeeded && i != 24){ | |
1876 int gotOne = -1; | |
1877 int gotTwo = -1; | |
1878 if (chordChoicesArray[i].optionArray[0].chordOption == 0 && chordChoicesArray[i].optionArray[1].chordOption == 0 && PApplet.parseInt(random(2)) == 0) | |
1879 chosenChord (i, chordChoicesArray[i].optionArray[1].chordOption); | |
1880 else if | |
1881 (chordChoicesArray[i].optionArray[0].chordOption == 0 && chordChoicesArray[i].optionArray[1].chordOption != 0) | |
1882 chosenChord (i, chordChoicesArray[i].optionArray[0].chordOption); | |
1883 else | |
1884 chosenChord (i, PApplet.parseInt(random(chordChoicesArray[i].slots))); | |
1885 } | |
1886 else if (i != 24){ | |
1887 chosenChord(i, PApplet.parseInt(random(chordChoicesArray[i].slots))); | |
1888 }else{ | |
1889 currentChord = lastChordChange; | |
1890 heresyMinor = lastMinor; | |
1891 } | |
1892 println(" chord selected : " + currentChord + " minor:" + heresyMinor); | |
1893 } | |
1894 | |
1895 public void chosenChord(int p, int p2){ | |
1896 lastChordChange = currentChord; | |
1897 lastMinor = heresyMinor; | |
1898 // println("p: " + p + " p2 : " + p2); | |
1899 currentChord = chordChoicesArray[p].optionArray[p2].chordOption; | |
1900 heresyMinor = chordChoicesArray[p].optionArray[p2].minor; | |
1901 if (PApplet.parseInt(random(4)) == 0) | |
1902 heresy7th = true; | |
1903 else | |
1904 heresy7th = false; | |
1905 if (PApplet.parseInt(random(4)) == 0) | |
1906 heresy9th = true; | |
1907 else | |
1908 heresy9th = false; | |
1909 if (PApplet.parseInt(random(4)) == 0) | |
1910 heresy11th = true; | |
1911 else | |
1912 heresy11th = false; | |
1913 | |
1914 | |
1915 } | |
1916 | |
1917 | |
1918 | |
1919 class chordChoices{ | |
1920 int chordNote; | |
1921 boolean minor; | |
1922 ChordChoice[] optionArray; | |
1923 int slots; | |
1924 | |
1925 public chordChoices(int chordNote, boolean minor, int slotsNeeded){ | |
1926 this.chordNote = chordNote; | |
1927 this.minor = minor; | |
1928 optionArray = new ChordChoice[slotsNeeded]; | |
1929 slots = slotsNeeded; | |
1930 } | |
1931 } | |
1932 | |
1933 class ChordChoice{ | |
1934 int chordOption; | |
1935 boolean minor, h7th, h9th, h11th, h13th, dom; | |
1936 | |
1937 public ChordChoice(int chordOption, boolean minor, boolean dom, boolean h7th, boolean h9th, boolean h11th, boolean h13th){ | |
1938 this.chordOption = chordOption; | |
1939 this.minor = minor; | |
1940 this.dom = dom; | |
1941 this.h7th = h7th; | |
1942 this.h9th = h9th; | |
1943 this.h11th = h11th; | |
1944 this.h13th = h13th; | |
1945 } | |
1946 } | |
1947 | |
1948 //void stuff(){ | |
1949 chordChoices[] chordChoicesArray = new chordChoices[crneeded]; | |
1950 | |
1951 public void markovStuff(){ | |
1952 chordChoicesArray[0] = new chordChoices(0, false, 13); | |
1953 chordChoicesArray[0].optionArray[0] = new ChordChoice(2, true, false, true, true, true, true); | |
1954 chordChoicesArray[0].optionArray[1] = new ChordChoice(3, false, false, true, true, true, true); | |
1955 chordChoicesArray[0].optionArray[2] = new ChordChoice(4, true, false, true, true, true, true); | |
1956 chordChoicesArray[0].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true); | |
1957 chordChoicesArray[0].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true); | |
1958 chordChoicesArray[0].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true); | |
1959 chordChoicesArray[0].optionArray[6] = new ChordChoice(7, false, false, true, true, true, true); | |
1960 chordChoicesArray[0].optionArray[7] = new ChordChoice(8, true, false, true, true, true, true); | |
1961 chordChoicesArray[0].optionArray[8] = new ChordChoice(8, false, false, true, true, true, true); | |
1962 chordChoicesArray[0].optionArray[9] = new ChordChoice(9, true, false, true, true, true, true); | |
1963 chordChoicesArray[0].optionArray[10] = new ChordChoice(9, false, false, true, true, true, true); | |
1964 chordChoicesArray[0].optionArray[11] = new ChordChoice(10, false, true, true, true, true, true); | |
1965 chordChoicesArray[0].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true); | |
1966 | |
1967 chordChoicesArray[1] = new chordChoices(0, true, 14); | |
1968 chordChoicesArray[1].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true); | |
1969 chordChoicesArray[1].optionArray[1] = new ChordChoice(3, false, false, true, true, true, true); | |
1970 chordChoicesArray[1].optionArray[2] = new ChordChoice(3, true, false, true, true, true, true); | |
1971 chordChoicesArray[1].optionArray[3] = new ChordChoice(4, true, false, true, true, true, true); | |
1972 chordChoicesArray[1].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true); | |
1973 chordChoicesArray[1].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); | |
1974 chordChoicesArray[1].optionArray[6] = new ChordChoice(6, true, false, true, true, true, true); | |
1975 chordChoicesArray[1].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); | |
1976 chordChoicesArray[1].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); | |
1977 chordChoicesArray[1].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); | |
1978 chordChoicesArray[1].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); | |
1979 chordChoicesArray[1].optionArray[11] = new ChordChoice(10, false, false, true, true, true, true); | |
1980 chordChoicesArray[1].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true); | |
1981 chordChoicesArray[1].optionArray[13] = new ChordChoice(11, false, false, true, true, true, true); | |
1982 | |
1983 chordChoicesArray[2] = new chordChoices(2, false, 9); | |
1984 chordChoicesArray[2].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true); | |
1985 chordChoicesArray[2].optionArray[1] = new ChordChoice(2, true, false, true, true, true, true); | |
1986 chordChoicesArray[2].optionArray[2] = new ChordChoice(5, false, false, true, true, true, true); | |
1987 chordChoicesArray[2].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true); | |
1988 chordChoicesArray[2].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true); | |
1989 chordChoicesArray[2].optionArray[5] = new ChordChoice(8, false, false, true, true, true, true); | |
1990 chordChoicesArray[2].optionArray[6] = new ChordChoice(9, false, false, true, true, true, true); | |
1991 chordChoicesArray[2].optionArray[7] = new ChordChoice(9, true, false, true, true, true, true); | |
1992 chordChoicesArray[2].optionArray[8] = new ChordChoice(10, false, false, true, true, true, true); | |
1993 | |
1994 chordChoicesArray[3] = new chordChoices(2, true, 13); | |
1995 chordChoicesArray[3].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
1996 chordChoicesArray[3].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true); | |
1997 chordChoicesArray[3].optionArray[2] = new ChordChoice(3, true, false, true, true, true, true); | |
1998 chordChoicesArray[3].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); | |
1999 chordChoicesArray[3].optionArray[4] = new ChordChoice(4, true, false, true, true, true, true); | |
2000 chordChoicesArray[3].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); | |
2001 chordChoicesArray[3].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); | |
2002 chordChoicesArray[3].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); | |
2003 chordChoicesArray[3].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); | |
2004 chordChoicesArray[3].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); | |
2005 chordChoicesArray[3].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); | |
2006 chordChoicesArray[3].optionArray[11] = new ChordChoice(10, false, false, true, true, true, true); | |
2007 chordChoicesArray[3].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true); | |
2008 | |
2009 chordChoicesArray[4] = new chordChoices(4, false, 4); | |
2010 chordChoicesArray[4].optionArray[0] = new ChordChoice(5, true, false, true, true, true, true); | |
2011 chordChoicesArray[4].optionArray[1] = new ChordChoice(9, false, false, true, true, true, true); | |
2012 chordChoicesArray[4].optionArray[2] = new ChordChoice(9, true, false, true, true, true, true); | |
2013 chordChoicesArray[4].optionArray[3] = new ChordChoice(11, true, false, true, true, true, true); | |
2014 | |
2015 chordChoicesArray[5] = new chordChoices(4, true, 13); | |
2016 chordChoicesArray[5].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2017 chordChoicesArray[5].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2018 chordChoicesArray[5].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2019 chordChoicesArray[5].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); | |
2020 chordChoicesArray[5].optionArray[4] = new ChordChoice(3, false, false, true, true, true, true); | |
2021 chordChoicesArray[5].optionArray[5] = new ChordChoice(3, true, false, true, true, true, true); | |
2022 chordChoicesArray[5].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); | |
2023 chordChoicesArray[5].optionArray[7] = new ChordChoice(5, true, false, true, true, true, true); | |
2024 chordChoicesArray[5].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true); | |
2025 chordChoicesArray[5].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); | |
2026 chordChoicesArray[5].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); | |
2027 chordChoicesArray[5].optionArray[11] = new ChordChoice(11, false, false, true, true, true, true); | |
2028 chordChoicesArray[5].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true); | |
2029 | |
2030 chordChoicesArray[6] = new chordChoices(5, false, 14); | |
2031 chordChoicesArray[6].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2032 chordChoicesArray[6].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2033 chordChoicesArray[6].optionArray[2] = new ChordChoice(2, true, false, true, true, true, true); | |
2034 chordChoicesArray[6].optionArray[3] = new ChordChoice(4, true, false, true, true, true, true); | |
2035 chordChoicesArray[6].optionArray[4] = new ChordChoice(4, false, false, true, true, true, true); | |
2036 chordChoicesArray[6].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); | |
2037 chordChoicesArray[6].optionArray[6] = new ChordChoice(6, true, false, true, true, true, true); | |
2038 chordChoicesArray[6].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); | |
2039 chordChoicesArray[6].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true); | |
2040 chordChoicesArray[6].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); | |
2041 chordChoicesArray[6].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); | |
2042 chordChoicesArray[6].optionArray[11] = new ChordChoice(9, false, false, true, true, true, true); | |
2043 chordChoicesArray[6].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true); | |
2044 chordChoicesArray[6].optionArray[13] = new ChordChoice(10, false, false, true, true, true, true); | |
2045 | |
2046 chordChoicesArray[7] = new chordChoices(5, true, 15); | |
2047 chordChoicesArray[7].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2048 chordChoicesArray[7].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2049 chordChoicesArray[7].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2050 chordChoicesArray[7].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); | |
2051 chordChoicesArray[7].optionArray[4] = new ChordChoice(2, false, false, true, true, true, true); | |
2052 chordChoicesArray[7].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); | |
2053 chordChoicesArray[7].optionArray[6] = new ChordChoice(4, false, false, true, true, true, true); | |
2054 chordChoicesArray[7].optionArray[7] = new ChordChoice(6, true, false, true, true, true, true); | |
2055 chordChoicesArray[7].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); | |
2056 chordChoicesArray[7].optionArray[9] = new ChordChoice(7, false, false, true, true, true, true); | |
2057 chordChoicesArray[7].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); | |
2058 chordChoicesArray[7].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); | |
2059 chordChoicesArray[7].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true); | |
2060 chordChoicesArray[7].optionArray[13] = new ChordChoice(11, false, false, true, true, true, true); | |
2061 chordChoicesArray[7].optionArray[14] = new ChordChoice(11, true, false, true, true, true, true); | |
2062 | |
2063 chordChoicesArray[8] = new chordChoices(7, true, 14); | |
2064 chordChoicesArray[8].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2065 chordChoicesArray[8].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2066 chordChoicesArray[8].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2067 chordChoicesArray[8].optionArray[3] = new ChordChoice(2, false, false, true, true, true, true); | |
2068 chordChoicesArray[8].optionArray[4] = new ChordChoice(2, true, false, true, true, true, true); | |
2069 chordChoicesArray[8].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); | |
2070 chordChoicesArray[8].optionArray[6] = new ChordChoice(3, true, false, true, true, true, true); | |
2071 chordChoicesArray[8].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true); | |
2072 chordChoicesArray[8].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true); | |
2073 chordChoicesArray[8].optionArray[9] = new ChordChoice(6, false, false, true, true, true, true); | |
2074 chordChoicesArray[8].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); | |
2075 chordChoicesArray[8].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); | |
2076 chordChoicesArray[8].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true); | |
2077 chordChoicesArray[8].optionArray[13] = new ChordChoice(10, true, false, true, true, true, true); | |
2078 | |
2079 chordChoicesArray[9] = new chordChoices(7, false, 10); | |
2080 chordChoicesArray[9].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2081 chordChoicesArray[9].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2082 chordChoicesArray[9].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true); | |
2083 chordChoicesArray[9].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); | |
2084 chordChoicesArray[9].optionArray[4] = new ChordChoice(4, true, false, true, true, true, true); | |
2085 chordChoicesArray[9].optionArray[5] = new ChordChoice(5, false, false, true, true, true, true); | |
2086 chordChoicesArray[9].optionArray[6] = new ChordChoice(5, true, false, true, true, true, true); | |
2087 chordChoicesArray[9].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true); | |
2088 chordChoicesArray[9].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true); | |
2089 chordChoicesArray[9].optionArray[9] = new ChordChoice(9, true, false, true, true, true, true); | |
2090 | |
2091 chordChoicesArray[10] = new chordChoices(9, true, 13); | |
2092 chordChoicesArray[10].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2093 chordChoicesArray[10].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2094 chordChoicesArray[10].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2095 chordChoicesArray[10].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); | |
2096 chordChoicesArray[10].optionArray[4] = new ChordChoice(2, false, false, true, true, true, true); | |
2097 chordChoicesArray[10].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); | |
2098 chordChoicesArray[10].optionArray[6] = new ChordChoice(4, true, false, true, true, true, true); | |
2099 chordChoicesArray[10].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true); | |
2100 chordChoicesArray[10].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true); | |
2101 chordChoicesArray[10].optionArray[9] = new ChordChoice(7, true, false, true, true, true, true); | |
2102 chordChoicesArray[10].optionArray[10] = new ChordChoice(7, false, false, true, true, true, true); | |
2103 chordChoicesArray[10].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); | |
2104 chordChoicesArray[10].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true); | |
2105 | |
2106 chordChoicesArray[11] = new chordChoices(11, false, 6); | |
2107 chordChoicesArray[11].optionArray[0] = new ChordChoice(0, true, false, true, true, true, true); | |
2108 chordChoicesArray[11].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true); | |
2109 chordChoicesArray[11].optionArray[2] = new ChordChoice(1, true, false, true, true, true, true); | |
2110 chordChoicesArray[11].optionArray[3] = new ChordChoice(1, false, false, true, true, true, true); | |
2111 chordChoicesArray[11].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true); | |
2112 chordChoicesArray[11].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true); | |
2113 | |
2114 chordChoicesArray[12] = new chordChoices(11, true, 5); | |
2115 chordChoicesArray[12].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true); | |
2116 chordChoicesArray[12].optionArray[1] = new ChordChoice(2, true, false, true, true, true, true); | |
2117 chordChoicesArray[12].optionArray[2] = new ChordChoice(5, false, true, true, true, true, true); | |
2118 chordChoicesArray[12].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true); | |
2119 chordChoicesArray[12].optionArray[4] = new ChordChoice(8, false, false, true, true, true, true); | |
2120 | |
2121 chordChoicesArray[13] = new chordChoices(1, false, 2); | |
2122 chordChoicesArray[13].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2123 chordChoicesArray[13].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2124 | |
2125 chordChoicesArray[14] = new chordChoices(1, true, 2); | |
2126 chordChoicesArray[14].optionArray[0] = new ChordChoice(0, true, false, true, true, true, true); | |
2127 chordChoicesArray[14].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2128 | |
2129 chordChoicesArray[15] = new chordChoices(3, false, 12); | |
2130 chordChoicesArray[15].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2131 chordChoicesArray[15].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2132 chordChoicesArray[15].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2133 chordChoicesArray[15].optionArray[3] = new ChordChoice(5, false, false, true, true, true, true); | |
2134 chordChoicesArray[15].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true); | |
2135 chordChoicesArray[15].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true); | |
2136 chordChoicesArray[15].optionArray[6] = new ChordChoice(8, true, false, true, true, true, true); | |
2137 chordChoicesArray[15].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true); | |
2138 chordChoicesArray[15].optionArray[8] = new ChordChoice(10, true, false, true, true, true, true); | |
2139 chordChoicesArray[15].optionArray[9] = new ChordChoice(10, false, false, true, true, true, true); | |
2140 chordChoicesArray[15].optionArray[10] = new ChordChoice(11, false, false, true, true, true, true); | |
2141 chordChoicesArray[15].optionArray[11] = new ChordChoice(11, true, false, true, true, true, true); | |
2142 | |
2143 chordChoicesArray[16] = new chordChoices(111, false, 2); | |
2144 chordChoicesArray[16].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2145 chordChoicesArray[16].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2146 | |
2147 chordChoicesArray[17] = new chordChoices(6, false, 10); | |
2148 chordChoicesArray[17].optionArray[0] = new ChordChoice(1, false, false, true, true, true, true); | |
2149 chordChoicesArray[17].optionArray[1] = new ChordChoice(1, true, false, true, true, true, true); | |
2150 chordChoicesArray[17].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true); | |
2151 chordChoicesArray[17].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); | |
2152 chordChoicesArray[17].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true); | |
2153 chordChoicesArray[17].optionArray[5] = new ChordChoice(8, false, false, true, true, true, true); | |
2154 chordChoicesArray[17].optionArray[6] = new ChordChoice(9, false, false, true, true, true, true); | |
2155 chordChoicesArray[17].optionArray[7] = new ChordChoice(9, true, false, true, true, true, true); | |
2156 chordChoicesArray[17].optionArray[8] = new ChordChoice(10, true, false, true, true, true, true); | |
2157 chordChoicesArray[17].optionArray[9] = new ChordChoice(10, false, false, true, true, true, true); | |
2158 | |
2159 chordChoicesArray[18] = new chordChoices(8, false, 17); | |
2160 chordChoicesArray[18].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2161 chordChoicesArray[18].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2162 chordChoicesArray[18].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2163 chordChoicesArray[18].optionArray[3] = new ChordChoice(1, true, false, true, true, true, true); | |
2164 chordChoicesArray[18].optionArray[4] = new ChordChoice(1, false, false, true, true, true, true); | |
2165 chordChoicesArray[18].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); | |
2166 chordChoicesArray[18].optionArray[6] = new ChordChoice(3, true, false, true, true, true, true); | |
2167 chordChoicesArray[18].optionArray[7] = new ChordChoice(4, false, false, true, true, true, true); | |
2168 chordChoicesArray[18].optionArray[8] = new ChordChoice(4, true, false, true, true, true, true); | |
2169 chordChoicesArray[18].optionArray[9] = new ChordChoice(5, true, false, true, true, true, true); | |
2170 chordChoicesArray[18].optionArray[10] = new ChordChoice(5, false, false, true, true, true, true); | |
2171 chordChoicesArray[18].optionArray[11] = new ChordChoice(7, false, false, true, true, true, true); | |
2172 chordChoicesArray[18].optionArray[12] = new ChordChoice(7, true, false, true, true, true, true); | |
2173 chordChoicesArray[18].optionArray[13] = new ChordChoice(9, true, false, true, true, true, true); | |
2174 chordChoicesArray[18].optionArray[14] = new ChordChoice(10, false, false, true, true, true, true); | |
2175 chordChoicesArray[18].optionArray[15] = new ChordChoice(11, false, false, true, true, true, true); | |
2176 chordChoicesArray[18].optionArray[16] = new ChordChoice(11, true, false, true, true, true, true); | |
2177 | |
2178 chordChoicesArray[19] = new chordChoices(8, true, 10); | |
2179 chordChoicesArray[19].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2180 chordChoicesArray[19].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2181 chordChoicesArray[19].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2182 chordChoicesArray[19].optionArray[3] = new ChordChoice(1, false, false, true, true, true, true); | |
2183 chordChoicesArray[19].optionArray[4] = new ChordChoice(3, false, false, true, true, true, true); | |
2184 chordChoicesArray[19].optionArray[5] = new ChordChoice(3, true, false, true, true, true, true); | |
2185 chordChoicesArray[19].optionArray[6] = new ChordChoice(4, false, false, true, true, true, true); | |
2186 chordChoicesArray[19].optionArray[7] = new ChordChoice(4, true, false, true, true, true, true); | |
2187 chordChoicesArray[19].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true); | |
2188 chordChoicesArray[19].optionArray[9] = new ChordChoice(5, false, false, true, true, true, true); | |
2189 | |
2190 chordChoicesArray[20] = new chordChoices(3, true, 19); | |
2191 chordChoicesArray[20].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2192 chordChoicesArray[20].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2193 chordChoicesArray[20].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2194 chordChoicesArray[20].optionArray[3] = new ChordChoice(2, false, false, true, true, true, true); | |
2195 chordChoicesArray[20].optionArray[4] = new ChordChoice(4, false, false, true, true, true, true); | |
2196 chordChoicesArray[20].optionArray[5] = new ChordChoice(4, true, false, true, true, true, true); | |
2197 chordChoicesArray[20].optionArray[6] = new ChordChoice(5, true, false, true, true, true, true); | |
2198 chordChoicesArray[20].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true); | |
2199 chordChoicesArray[20].optionArray[8] = new ChordChoice(6, true, false, true, true, true, true); | |
2200 chordChoicesArray[20].optionArray[9] = new ChordChoice(6, false, false, true, true, true, true); | |
2201 chordChoicesArray[20].optionArray[10] = new ChordChoice(7, true, false, true, true, true, true); | |
2202 chordChoicesArray[20].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); | |
2203 chordChoicesArray[20].optionArray[12] = new ChordChoice(8, true, false, true, true, true, true); | |
2204 chordChoicesArray[20].optionArray[13] = new ChordChoice(9, true, false, true, true, true, true); | |
2205 chordChoicesArray[20].optionArray[14] = new ChordChoice(9, false, false, true, true, true, true); | |
2206 chordChoicesArray[20].optionArray[15] = new ChordChoice(10, false, false, true, true, true, true); | |
2207 chordChoicesArray[20].optionArray[16] = new ChordChoice(10, true, false, true, true, true, true); | |
2208 chordChoicesArray[20].optionArray[17] = new ChordChoice(11, false, false, true, true, true, true); | |
2209 chordChoicesArray[20].optionArray[18] = new ChordChoice(11, true, false, true, true, true, true); | |
2210 | |
2211 chordChoicesArray[21] = new chordChoices(6, true, 9); | |
2212 chordChoicesArray[21].optionArray[0] = new ChordChoice(1, false, false, true, true, true, true); | |
2213 chordChoicesArray[21].optionArray[1] = new ChordChoice(1, true, false, true, true, true, true); | |
2214 chordChoicesArray[21].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true); | |
2215 chordChoicesArray[21].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); | |
2216 chordChoicesArray[21].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true); | |
2217 chordChoicesArray[21].optionArray[5] = new ChordChoice(4, false, false, true, true, true, true); | |
2218 chordChoicesArray[21].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); | |
2219 chordChoicesArray[21].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true); | |
2220 chordChoicesArray[21].optionArray[8] = new ChordChoice(11, true, false, true, true, true, true); | |
2221 | |
2222 chordChoicesArray[22] = new chordChoices(10, false, 13); | |
2223 chordChoicesArray[22].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2224 chordChoicesArray[22].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); | |
2225 chordChoicesArray[22].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); | |
2226 chordChoicesArray[22].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); | |
2227 chordChoicesArray[22].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true); | |
2228 chordChoicesArray[22].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); | |
2229 chordChoicesArray[22].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); | |
2230 chordChoicesArray[22].optionArray[7] = new ChordChoice(6, false, false, true, true, true, true); | |
2231 chordChoicesArray[22].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); | |
2232 chordChoicesArray[22].optionArray[9] = new ChordChoice(7, false, false, true, true, true, true); | |
2233 chordChoicesArray[22].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); | |
2234 chordChoicesArray[22].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); | |
2235 chordChoicesArray[22].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true); | |
2236 | |
2237 chordChoicesArray[23] = new chordChoices(10, true, 12); | |
2238 chordChoicesArray[23].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); | |
2239 chordChoicesArray[23].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true); | |
2240 chordChoicesArray[23].optionArray[2] = new ChordChoice(3, false, false, true, true, true, true); | |
2241 chordChoicesArray[23].optionArray[3] = new ChordChoice(3, true, false, true, true, true, true); | |
2242 chordChoicesArray[23].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true); | |
2243 chordChoicesArray[23].optionArray[5] = new ChordChoice(6, true, false, true, true, true, true); | |
2244 chordChoicesArray[23].optionArray[6] = new ChordChoice(6, false, false, true, true, true, true); | |
2245 chordChoicesArray[23].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); | |
2246 chordChoicesArray[23].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); | |
2247 chordChoicesArray[23].optionArray[9] = new ChordChoice(9, false, false, true, true, true, true); | |
2248 chordChoicesArray[23].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); | |
2249 chordChoicesArray[23].optionArray[11] = new ChordChoice(11, true, false, true, true, true, true); | |
2250 | |
2251 | |
2252 } | |
2253 public void loadSequences(){ | |
2254 | |
2255 ArrayList<NoteEvent> sequenceBass = new ArrayList<NoteEvent>(); | |
2256 sequenceBass.add(new NoteEvent(15, 2, 1, 1, 1, 1, 0, 3, 3, 0)); | |
2257 // sequenceBass.add(new NoteEvent(15, 2, 1, 1, 2, 1, 0, 0, 0, 5)); | |
2258 // sequenceBass.add(new NoteEvent(15, 2, 1, 2, 3, 1, 0, 0, 0, 5)); | |
2259 // sequenceBass.add(new NoteEvent(15, 2, 1, 2, 4, 1, 0, 0, 0, 5)); | |
2260 // sequenceBass.add(new NoteEvent(15, 2, 1, 3, 2, 1, 0, 0, 0, 5)); | |
2261 // sequenceBass.add(new NoteEvent(15, 2, 1, 3, 3, 1, 0, 0, 0, 5)); | |
2262 // sequenceBass.add(new NoteEvent(15, 2, 1, 4, 1, 1, 0, 0, 0, 5)); | |
2263 // sequenceBass.add(new NoteEvent(15, 2, 1, 4, 2, 1, 0, 0, 0, 5)); | |
2264 seedSequencer(sequenceBass, 2); | |
2265 | |
2266 ArrayList<NoteEvent> sequencePizz = new ArrayList<NoteEvent>(); | |
2267 sequencePizz.add(new NoteEvent(13, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2268 sequencePizz.add(new NoteEvent(12, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2269 sequencePizz.add(new NoteEvent(11, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2270 sequencePizz.add(new NoteEvent(10, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2271 sequencePizz.add(new NoteEvent(9, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2272 // sequencePizz.add(new NoteEvent(8, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2273 // sequencePizz.add(new NoteEvent(7, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2274 // sequencePizz.add(new NoteEvent(6, 2, 1, 1, 3, 1, 0, 0, 1, 0)); | |
2275 sequencePizz.add(new NoteEvent(0, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2276 sequencePizz.add(new NoteEvent(1, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2277 sequencePizz.add(new NoteEvent(2, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2278 sequencePizz.add(new NoteEvent(3, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2279 sequencePizz.add(new NoteEvent(4, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2280 // sequencePizz.add(new NoteEvent(8, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2281 // sequencePizz.add(new NoteEvent(7, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2282 // sequencePizz.add(new NoteEvent(6, 2, 1, 2, 3, 1, 0, 0, 1, 0)); | |
2283 sequencePizz.add(new NoteEvent(13, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2284 sequencePizz.add(new NoteEvent(12, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2285 sequencePizz.add(new NoteEvent(11, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2286 sequencePizz.add(new NoteEvent(10, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2287 sequencePizz.add(new NoteEvent(9, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2288 // sequencePizz.add(new NoteEvent(8, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2289 // sequencePizz.add(new NoteEvent(7, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2290 // sequencePizz.add(new NoteEvent(6, 2, 1, 3, 3, 1, 0, 0, 1, 0)); | |
2291 sequencePizz.add(new NoteEvent(0, 2, 1, 4, 1, 1, 0, 0, 1, 0)); | |
2292 sequencePizz.add(new NoteEvent(1, 2, 1, 4, 1, 1, 0, 0, 1, 0)); | |
2293 sequencePizz.add(new NoteEvent(2, 2, 1, 4, 1, 1, 0, 0, 1, 0)); | |
2294 sequencePizz.add(new NoteEvent(3, 2, 1, 4, 1, 1, 0, 0, 1, 0)); | |
2295 sequencePizz.add(new NoteEvent(4, 2, 1, 4, 1, 1, 0, 0, 1, 0)); | |
2296 // sequencePizz.add(new NoteEvent(8, 2, 1, 4, 3, 1, 0, 0, 1, 0)); | |
2297 // sequencePizz.add(new NoteEvent(7, 2, 1, 4, 3, 1, 0, 0, 1, 0)); | |
2298 // sequencePizz.add(new NoteEvent(6, 2, 1, 4, 3, 1, 0, 0, 1, 0)); | |
2299 seedSequencer(sequencePizz, 3); | |
2300 /* | |
2301 ArrayList<NoteEvent> sequenceStrings = new ArrayList<NoteEvent>(); | |
2302 sequenceStrings.add(new NoteEvent(13, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2303 sequenceStrings.add(new NoteEvent(12, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2304 sequenceStrings.add(new NoteEvent(11, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2305 sequenceStrings.add(new NoteEvent(10, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2306 sequenceStrings.add(new NoteEvent(9, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2307 sequenceStrings.add(new NoteEvent(8, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2308 sequenceStrings.add(new NoteEvent(7, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2309 sequenceStrings.add(new NoteEvent(6, 2, 1, 1, 1, 1, 0, 1, 3, 0)); | |
2310 seedSequencer(sequenceStrings, 4); | |
2311 */ | |
2312 | |
2313 } | |
2314 | |
2315 public void seedSequencer(ArrayList<NoteEvent> sIn, int track){ | |
2316 for (int i = 0; i < sIn.size(); i++){ | |
2317 NoteEvent s = sIn.get(i); | |
2318 // println("info stuff : " + s[i].notePitch); | |
2319 tracks[track].sequence[s.notePitch][(s.notePosition[0]-1)*pulsesPerBar + (s.notePosition[1]-1)*grid + (s.notePosition[2]-1)*(grid/fractions) + s.notePosition[3]] = new NoteEvent (s.notePitch, s.channel, bar,beat,fraction,pulse); | |
2320 tracks[track].sequence[s.notePitch][(s.notePosition[0]-1)*pulsesPerBar + (s.notePosition[1]-1)*grid + (s.notePosition[2]-1)*(grid/fractions) + s.notePosition[3] + s.noteLength[0]*pulsesPerBar + s.noteLength[1]*grid + s.noteLength[2]*grid/fractions + s.noteLength[3]] = new NoteEvent (s.notePitch, s.channel, bar,beat,fraction,pulse, true); | |
2321 } | |
2322 } | |
2323 static public void main(String args[]) { | |
2324 PApplet.main(new String[] { "--bgcolor=#FFFFFF", "HeresyBigBangDone" }); | |
2325 } | |
2326 } |