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