andrew@50: import processing.core.*; andrew@50: import processing.xml.*; andrew@50: andrew@50: import oscP5.*; andrew@50: import netP5.*; andrew@50: import maxlink.*; andrew@50: import processing.opengl.*; andrew@50: andrew@50: import com.cycling74.max.*; andrew@50: import com.cycling74.net.*; andrew@50: import com.cycling74.msp.*; andrew@50: import netP5.*; andrew@50: import maxlink.*; andrew@50: import com.cycling74.io.*; andrew@50: import com.cycling74.util.*; andrew@50: import com.cycling74.mxjedit.*; andrew@50: import oscP5.*; andrew@50: andrew@50: import java.applet.*; andrew@50: import java.awt.Dimension; andrew@50: import java.awt.Frame; andrew@50: import java.awt.event.MouseEvent; andrew@50: import java.awt.event.KeyEvent; andrew@50: import java.awt.event.FocusEvent; andrew@50: import java.awt.Image; andrew@50: import java.io.*; andrew@50: import java.net.*; andrew@50: import java.text.*; andrew@50: import java.util.*; andrew@50: import java.util.zip.*; andrew@50: import java.util.regex.*; andrew@50: andrew@50: public class HeresyBigBangDone extends PApplet { andrew@50: andrew@50: andrew@50: andrew@50: public void setup(){ andrew@50: markovStuff(); andrew@50: for (int i = 0; i < 16; i++) andrew@50: VPA[i] = new VPArray(); // creates the virtual playing array for Heresy AI. andrew@50: for (int i = 0; i < noteOnArray.length; i++) andrew@50: noteOnArray[i] = false; // makes sure there are initial random inputs from openFrameworks andrew@50: andrew@50: oscP5return = new OscP5(this,12346); andrew@50: andrew@50: frameRate(tempo); andrew@50: img = createGraphics(imageWidth,imageHeight,P2D); andrew@50: size(800,imageHeight,P2D); andrew@50: arial = createFont("Arial",32); andrew@50: textFont(arial,15); andrew@50: andrew@50: // initialize the tracks andrew@50: andrew@50: tracks[0] = new Track("Chord track", true, grid * beatsPerBar, 8, true, true); andrew@50: tracks[1] = new Track("Drums", true, grid * beatsPerBar, 8, false, true); andrew@50: tracks[2] = new Track("Bass", true, grid * beatsPerBar, 8, false, true); andrew@50: tracks[3] = new Track("Pizz Strings", true, grid * beatsPerBar, 8, false, true); andrew@50: tracks[4] = new Track("Synth", true, grid * beatsPerBar, 8, false, true); andrew@50: tracks[5] = new Track("Voice", true, grid * beatsPerBar, 8, false, true); andrew@50: tracks[6] = new Track("Voice", true, grid * beatsPerBar, 8, false, true); andrew@50: chordsTemp = new Track("Chord track", true, loopLength, 8, true, false); andrew@50: trSelected = 1; andrew@50: backgroundColour(); andrew@50: drawLines(); andrew@50: drawBarLines(); andrew@50: imgNoteFan = createGraphics(fanWidth,imageHeight,P2D); andrew@50: lastTrack = trSelected; andrew@50: clickTrackOn = true; andrew@50: // loadSequences(); andrew@50: // tracks[2].sequence[15][16] = new NoteEvent (14, 2, bar,beat,fraction,pulse); andrew@50: // tracks[2].sequence[15][grid * beatsPerBar -20] = new NoteEvent (14, 2, bar,beat,fraction,pulse, true); andrew@50: andrew@50: // tracks[3].sequence[13][16] = new NoteEvent (13, 3, bar,beat,fraction,pulse); andrew@50: // tracks[3].sequence[13][20] = new NoteEvent (13, 3, bar,beat,fraction,pulse, true); andrew@50: // tracks[3].sequence[12][16] = new NoteEvent (12, 3, bar,beat,fraction,pulse); andrew@50: // tracks[3].sequence[12][20] = new NoteEvent (12, 3, bar,beat,fraction,pulse, true); andrew@50: // tracks[3].sequence[11][16] = new NoteEvent (11, 3, bar,beat,fraction,pulse); andrew@50: // tracks[3].sequence[11][20] = new NoteEvent (11, 3, bar,beat,fraction,pulse, true); andrew@50: // tracks[3].sequence[10][16] = new NoteEvent (10, 3, bar,beat,fraction,pulse); andrew@50: // tracks[3].sequence[10][20] = new NoteEvent (10, 3, bar,beat,fraction,pulse, true); andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void draw(){ andrew@50: /* if (currentPulse % (grid * beatsPerBar) == grid * beatsPerBar -1){ andrew@50: int tempTrackSelected = trSelected; andrew@50: for (int j = 0; j < 16; j++){ andrew@50: trSelected = j; andrew@50: if (tracks[j] != null){ andrew@50: for (int i = 0; i < 16; i++){ andrew@50: noteOnArray[i] = false; andrew@50: finishNote(i); andrew@50: displayNoteOnArray[i] = false; andrew@50: for (int z = 24; z < 109; z++) andrew@50: outputToMax(z, 0, j); andrew@50: } andrew@50: tracks[j] = new Track(tracks[j].name, true, tracks[j].loopLength, tracks[j].quantize, false, false); andrew@50: imgNotes = null; andrew@50: } andrew@50: } andrew@50: trSelected = tempTrackSelected; andrew@50: } andrew@50: */ andrew@50: // tracks[0] = new Track("Chord track", true, grid * beatsPerBar, 8, true, true); andrew@50: // tracks[1] = new Track("Drums", true, grid * beatsPerBar, 8, false, true); andrew@50: // tracks[2] = new Track("Bass", true, grid * beatsPerBar, 8, false, true); andrew@50: // tracks[3] = new Track("Pizz Strings", true, grid * beatsPerBar, 8, false, true); andrew@50: // tracks[4] = new Track("Synth", true, grid * beatsPerBar, 8, false, true); andrew@50: // tracks[5] = new Track("Voice", true, grid * beatsPerBar, 8, false, true); andrew@50: // } andrew@50: workOutPosition(); // calculates current bar, beat and pulse position andrew@50: //println(bar + " " + beat + " " + fraction + " " + pulse); andrew@50: // if (chordAI && bar > 1) andrew@50: // chordCalc(); andrew@50: if (eraseOn) andrew@50: eraseNotes(); andrew@50: calcColours(); // calcs chord colours for background and grid andrew@50: heresyChange = false; andrew@50: heresyChordChanged = false; andrew@50: if (trackStorer != trSelected){ // resets display when changing tracks andrew@50: for (int i = 0; i < 16; i++) andrew@50: if (noteOnArray[i] = true){ andrew@50: noteOnArray[i] = false; andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: trackStorer = trSelected; andrew@50: imgNotes = null; andrew@50: } andrew@50: if (imgNotes == null) andrew@50: imgNotes = createGraphics(tracks[trSelected].loopLength,imageHeight,P2D); andrew@50: background(0); andrew@50: image (img,width-x2-playArea,0); andrew@50: drawTempImageGrid(); andrew@50: createNoteFan(); andrew@50: drawNotes(); andrew@50: fill (0); andrew@50: noStroke(); andrew@50: rect (width-playArea,0,playArea,height); andrew@50: image (imgNoteFan, width-playArea+3,0); andrew@50: pulseFrame(x); // Draws a pulsing white line at the left edge of the edit area andrew@50: if (haveQuestion) writeQuestion(); // for input request messages andrew@50: x++; // counter for grid movement andrew@50: x2++; // counter for note image movement andrew@50: if (x2 == width - playArea + grid * beatsPerBar) andrew@50: x2 = width - playArea; andrew@50: if (x == width - playArea + tracks[trSelected].loopLength) andrew@50: x = width - playArea; andrew@50: andrew@50: andrew@50: /* if (clickTrackOn){ // click track andrew@50: if (fraction == 1){ andrew@50: if (pulse == 1){ andrew@50: String noteOut = ("37 80 1"); andrew@50: link.output(noteOut); andrew@50: } andrew@50: if (pulse == 2){ andrew@50: String noteOut = ("37 0 1" ); andrew@50: link.output(noteOut); andrew@50: } andrew@50: } andrew@50: } andrew@50: */ andrew@50: checkForMutes(); andrew@50: checkCycled(); andrew@50: playTrackEvents(); andrew@50: andrew@50: fill(255,255,255); andrew@50: textSize(15); andrew@50: text(bar + " " + beat + " " + fraction + " " + pulse, 10,20); // draws current time position to screen andrew@50: andrew@50: fill(200,0,0); andrew@50: textSize(15); andrew@50: // this section draws current track and track info to screen andrew@50: if (tracks[trSelected].ducking) andrew@50: text(tracks[trSelected].name + " ducking", 100,20); andrew@50: else andrew@50: text(tracks[trSelected].name, 100,20); andrew@50: if (tracks[trSelected].muteIn > bar) andrew@50: if (!tracks[trSelected].mute) andrew@50: text("mute in " + (tracks[trSelected].muteIn - bar), 200,20); andrew@50: else andrew@50: text("unmute in " + (tracks[trSelected].muteIn - bar), 200,20); andrew@50: andrew@50: if (haveQuestion){ // asks input questions andrew@50: writeQuestion(); andrew@50: } andrew@50: // println(currentPulse + " "); andrew@50: andrew@50: andrew@50: currentPulse++; // advances the sequencer to next pulse andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void eraseNotes(){ // erases notes in current track if selected andrew@50: if (trSelected != 0){ andrew@50: for (int i = 0; i < 16; i++){ andrew@50: if (tracks[trSelected].sequence[i][(currentPulse%(tracks[trSelected].loopLength))] != null){ andrew@50: tracks[trSelected].sequence[i][(currentPulse%(tracks[trSelected].loopLength))] = null; andrew@50: } andrew@50: } andrew@50: } andrew@50: if (trSelected == 0){ andrew@50: for (int i = 0; i < 16; i++){ andrew@50: if (chordsTemp.sequence[i][(currentPulse%(tracks[trSelected].loopLength))] != null){ andrew@50: chordsTemp.sequence[i][(currentPulse%(tracks[trSelected].loopLength))] = null; andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void workOutPosition(){ // works out current position andrew@50: if (currentPulse%(grid*beatsPerBar) == 0) andrew@50: ++bar; andrew@50: if (currentPulse%grid == 0) andrew@50: ++beat; andrew@50: if (beat > beatsPerBar) andrew@50: beat = 1; andrew@50: if (currentPulse%(grid/fractions) == 0) andrew@50: ++fraction; andrew@50: if (fraction > fractions) andrew@50: fraction = 1; andrew@50: ++pulse; andrew@50: if (pulse > (grid/fractions)) andrew@50: pulse = 1; andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void finishNote(int noteArrayPosition){ // writes note offs into the sequencers andrew@50: if (trSelected != 0) andrew@50: tracks[trSelected].sequence[noteArrayPosition][(currentPulse%(tracks[trSelected].loopLength))] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse, true); andrew@50: if (trSelected == 0) andrew@50: chordsTemp.sequence[noteArrayPosition][(currentPulse%(chordsTemp.loopLength))] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse, true); andrew@50: displayNoteOnArray[noteArrayPosition] = false; andrew@50: } andrew@50: andrew@50: public void finishNote(int noteArrayPosition, int channel){ // writes note offs into the sequencers andrew@50: if (trSelected != 0) andrew@50: tracks[trSelected].sequence[noteArrayPosition][(currentPulse%(tracks[trSelected].loopLength))] = new NoteEvent (noteArrayPosition, channel, bar,beat,fraction,pulse, true); andrew@50: if (trSelected == 0) andrew@50: chordsTemp.sequence[noteArrayPosition][(currentPulse%(chordsTemp.loopLength))] = new NoteEvent (noteArrayPosition, channel, bar,beat,fraction,pulse, true); andrew@50: displayNoteOnArray[noteArrayPosition] = false; andrew@50: } andrew@50: andrew@50: andrew@50: //----------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: 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: tracks[lastTrack].sequence[noteArrayPosition][(currentPulse%(tracks[lastTrack].loopLength))] = new NoteEvent (noteArrayPosition, lastTrack+1, bar,beat,fraction,pulse, true); andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void writeNote(int noteArrayPosition, int veloc){ // writes note ons into the sequencers andrew@50: if (trSelected != 0){ andrew@50: int quantizeOffset = getQuantizeOffset(); andrew@50: if (quantizeOffset >= 0){ andrew@50: tracks[trSelected].sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); andrew@50: } andrew@50: if (quantizeOffset < 0){ andrew@50: tracks[trSelected].sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); andrew@50: andrew@50: VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNoteOn = true; andrew@50: if (trSelected !=1 && trSelected !=5) andrew@50: VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 3); andrew@50: else andrew@50: VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 1); andrew@50: VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNoteVelocity = veloc; andrew@50: sendNote(VPA[trSelected].VPArrayNotes[noteArrayPosition], trSelected); andrew@50: displayNoteOnArray[noteArrayPosition] = true; andrew@50: andrew@50: } andrew@50: } andrew@50: if (trSelected == 0){ andrew@50: int quantizeOffset = getQuantizeOffset(); andrew@50: if (quantizeOffset >= 0){ andrew@50: chordsTemp.sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); andrew@50: } andrew@50: if (quantizeOffset < 0){ andrew@50: chordsTemp.sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse); andrew@50: andrew@50: if (noteArrayPosition > 3) andrew@50: currentChord = 15 - noteArrayPosition; andrew@50: displayNoteOnArray[noteArrayPosition] = true; andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: public void writeNote(int noteArrayPosition, int veloc, int channel){ // writes note ons into the sequencers andrew@50: VPA[channel].VPArrayNotes[noteArrayPosition].VPNoteOn = true; andrew@50: VPA[channel].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 1); andrew@50: VPA[channel].VPArrayNotes[noteArrayPosition].VPNoteVelocity = veloc; andrew@50: sendNote(VPA[channel].VPArrayNotes[noteArrayPosition], channel); andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public int getQuantizeOffset(){ // tells write note method the quantize offset. andrew@50: int quantizeInPulses = pulsesPerBar/(tracks[trSelected].quantize); andrew@50: int quantizeOffset = currentPulse % quantizeInPulses; andrew@50: if (quantizeOffset > quantizeInPulses/2.0f){ andrew@50: return ((quantizeOffset - quantizeInPulses) * -1) ; andrew@50: } andrew@50: else{ andrew@50: return quantizeOffset * -1; andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void drawNotes(){ // places the note display grid into the apropriate screen positions andrew@50: int loopsOnScreen = ((width-playArea) / tracks[trSelected].loopLength) + 1; andrew@50: if (loopsOnScreen > currentPulse / tracks[trSelected].loopLength) andrew@50: loopsOnScreen = currentPulse / tracks[trSelected].loopLength; andrew@50: for (int i = 0; i <= loopsOnScreen; i++) andrew@50: image (imgNotes, (width-playArea-(i*tracks[trSelected].loopLength))-currentPulse%(tracks[trSelected].loopLength),0); andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void pulseFrame(int frameNo){ // Draws a pulsing line at left hand side of the input area when loop restarts andrew@50: strokeWeight(3); andrew@50: if (currentPulse % (tracks[trSelected].loopLength) == 0 || (currentPulse-1) % (tracks[trSelected].loopLength) == 0 || (currentPulse-2) % (tracks[trSelected].loopLength) == 0) andrew@50: stroke(255,255,255); andrew@50: else andrew@50: stroke(255,111,111); andrew@50: line (width-playArea+3, 1, width-playArea+3, 300); andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void drawTempImageGrid(){ // draws the note display image grid andrew@50: imgNotes.stroke(209,137,255); andrew@50: imgNotes.strokeWeight(15); andrew@50: for(int i = 0; i < 16; i++){ andrew@50: if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ andrew@50: imgNotes.beginDraw(); andrew@50: imgNotes.line (currentPulse%(tracks[trSelected].loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(tracks[trSelected].loopLength)+1, i*imageHeight/16+imageHeight/32); andrew@50: imgNotes.endDraw(); andrew@50: displayNoteOnArray[i] = true; andrew@50: } andrew@50: if (tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity == 0){ andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: andrew@50: if(trSelected ==0){ andrew@50: if ((chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ andrew@50: imgNotes.beginDraw(); andrew@50: imgNotes.line (currentPulse%(chordsTemp.loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(chordsTemp.loopLength)+1, i*imageHeight/16+imageHeight/32); andrew@50: imgNotes.endDraw(); andrew@50: displayNoteOnArray[i] = true; andrew@50: } andrew@50: if (chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0){ andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void drawLines(){ // draws beat lines andrew@50: int linePosition = 1; andrew@50: int i = 0; andrew@50: for (; linePosition <= imageWidth;){ andrew@50: linePosition = i * grid; andrew@50: img.beginDraw(); andrew@50: img.stroke(lineColour); andrew@50: img.strokeWeight(2); andrew@50: img.line (linePosition, 0, linePosition, imageHeight); andrew@50: img.endDraw(); andrew@50: i++; andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void drawBarLines(){ // draws bar lines andrew@50: int linePosition = 1; andrew@50: for (int i = 0; linePosition <= imageWidth;){ andrew@50: linePosition = i * grid * beatsPerBar; andrew@50: img.beginDraw(); andrew@50: img.stroke(barLineColour); andrew@50: img.strokeWeight(2); andrew@50: img.line (linePosition, 0, linePosition, imageHeight); andrew@50: img.endDraw(); andrew@50: i++; andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void backgroundColour(){ // sets background colour andrew@50: img.beginDraw(); andrew@50: img.background (backGround); andrew@50: img.endDraw(); andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void createNoteFan(){ // creates the input fan andrew@50: if (rpulseup) andrew@50: rpulse++; andrew@50: else rpulse--; andrew@50: if (rpulse == grid) andrew@50: rpulseup = false; andrew@50: if (rpulse < 1) andrew@50: rpulseup = true; andrew@50: imgNoteFan.beginDraw(); andrew@50: imgNoteFan.stroke(rpulse/grid*255,50,50); andrew@50: imgNoteFan.strokeWeight(1); andrew@50: for (int i = 0; i < 16; i++){ andrew@50: if (!chordSelecter) andrew@50: if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ andrew@50: imgNoteFan.fill(209,137,255); andrew@50: } andrew@50: else andrew@50: imgNoteFan.fill(0,0,0); andrew@50: else andrew@50: if (i == 14 || i == 12 || i == 9 || i == 7 || i == 5 || i == 3 || i == 2 || i == 1 || i == 0) andrew@50: imgNoteFan.fill(0,0,0); andrew@50: else andrew@50: imgNoteFan.fill(255,255,255); andrew@50: imgNoteFan.quad(0, i*(imageHeight/16.0f), 0, (i+1)*(imageHeight/16.0f), fanWidth, (imageHeight/2.0f), fanWidth, (imageHeight/2.0f)); andrew@50: } andrew@50: andrew@50: imgNoteFan.endDraw(); andrew@50: andrew@50: } andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void calcColours(){ // sets up colour values for background, bar and beat lines andrew@50: andrew@50: if(heresyChordChanged){ andrew@50: andrew@50: if(currentChord == 0){ andrew@50: redC = 0; andrew@50: greenC = 0; andrew@50: blueC = 0; andrew@50: } andrew@50: andrew@50: if(currentChord == 1){ andrew@50: redC = 90; andrew@50: greenC = 76; andrew@50: blueC = 3; andrew@50: } andrew@50: andrew@50: if(currentChord == 2){ andrew@50: redC = 254; andrew@50: greenC = 255; andrew@50: blueC = 18; andrew@50: } andrew@50: andrew@50: if(currentChord == 3){ andrew@50: redC = 0; andrew@50: greenC = 0; andrew@50: blueC = 0; andrew@50: } andrew@50: andrew@50: if(currentChord == 4){ andrew@50: redC = 136; andrew@50: greenC = 245; andrew@50: blueC = 49; andrew@50: } andrew@50: andrew@50: if(currentChord == 5){ andrew@50: redC = 9; andrew@50: greenC = 18; andrew@50: blueC = 232; andrew@50: } andrew@50: andrew@50: if(currentChord == 6){ andrew@50: redC = 99; andrew@50: greenC = 99; andrew@50: blueC = 100; andrew@50: } andrew@50: andrew@50: if(currentChord == 7){ andrew@50: redC = 255; andrew@50: greenC = 166; andrew@50: blueC = 21; andrew@50: } andrew@50: andrew@50: if(currentChord == 8){ andrew@50: redC = 13; andrew@50: greenC = 79; andrew@50: blueC = 147; andrew@50: } andrew@50: andrew@50: if(currentChord == 9){ andrew@50: redC = 255; andrew@50: greenC = 165; andrew@50: blueC = 165; andrew@50: } andrew@50: andrew@50: if(currentChord == 10){ andrew@50: redC = 89; andrew@50: greenC = 110; andrew@50: blueC = 134; andrew@50: } andrew@50: andrew@50: if(currentChord == 11){ andrew@50: redC = 68; andrew@50: greenC = 242; andrew@50: blueC = 250; andrew@50: } andrew@50: andrew@50: backGround = color(redC, greenC, blueC); andrew@50: lineColour = color((redC + 100) % 255,(greenC + 69) % 255,(blueC + 214) % 255); andrew@50: barLineColour = color((redC + 205) % 255, (greenC + 174) % 255, (blueC + 159) % 255); andrew@50: andrew@50: backgroundColour(); andrew@50: drawLines(); andrew@50: drawBarLines(); andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: OscP5 oscP5return; andrew@50: NetAddress ableton = new NetAddress("localhost", 12345); // OSC to ableton andrew@50: MaxLink link = new MaxLink(this, "midiCom"); andrew@50: andrew@50: int imageWidth = 1000; andrew@50: int imageHeight = 300; andrew@50: int fanWidth = 400; andrew@50: andrew@50: float rpulse; andrew@50: boolean rpulseup; andrew@50: boolean clickTrack; andrew@50: int currentPulse = 0; andrew@50: int grid = 32; andrew@50: int fractions = 4; andrew@50: int pulseFrequency = grid / fractions; andrew@50: int beatsPerBar = 4; andrew@50: int bar = 0, beat = 0, fraction = 0, pulse = 0; andrew@50: int pulsesPerBar = beatsPerBar * grid; andrew@50: andrew@50: int lineColour = color(150,150,150); andrew@50: int barLineColour = color(255,255,95); andrew@50: int backGround = color(50,81,191); andrew@50: int redC = 50; andrew@50: int greenC = 81; andrew@50: int blueC = 191; andrew@50: PImage screenImage; andrew@50: PGraphics img, imgNotes, imgNoteFan; andrew@50: PImage test; andrew@50: andrew@50: int barOfPixels = grid * beatsPerBar; andrew@50: int playArea = 200; andrew@50: int x= 0; andrew@50: int x2= 0; andrew@50: PFont arial; andrew@50: int arraySize = 800-playArea; andrew@50: int bpm = 130; andrew@50: int tempo = bpm/60*grid; andrew@50: int noOfBars = 2; andrew@50: int loopLength = grid*beatsPerBar*noOfBars; andrew@50: Track[] tracks = new Track[16]; andrew@50: Track chordsTemp; andrew@50: int trSelected; andrew@50: boolean[] noteOnArray = new boolean[16]; andrew@50: boolean[] displayNoteOnArray = new boolean[16]; andrew@50: int[] noteOnArrayLength = new int[16]; andrew@50: boolean chordSelecter, clickTrackOn; andrew@50: int lastTrack; andrew@50: int trackStorer, screenAni; andrew@50: boolean quantizeValueIn, loopLengthValueIn, haveQuestion, aniOut, muteValueIn; andrew@50: String screenQuestion; andrew@50: boolean eraseOn; andrew@50: andrew@50: int crneeded = 24; andrew@50: int noOfChords; andrew@50: boolean tonicNeeded; andrew@50: boolean chordAI = true; andrew@50: int lastChordChange; andrew@50: boolean lastMinor; andrew@50: int barCounter; andrew@50: andrew@50: boolean heresyMinor, oldHeresyMinor, heresy7th, oldHeresy7th, heresy9th, oldHeresy9th, heresy11th, oldHeresy11th, heresy13th, oldHeresy13th, heresyDom; andrew@50: boolean heresyMinorChanged, heresyChordChanged, heresy7thChanged, heresy9thChanged, heresy11thChanged, heresy13thChanged, heresyChange, dontRevoice; andrew@50: int currentChord, lastChord; andrew@50: VPArray[] VPA = new VPArray[16]; andrew@50: int[] notesOnArray = new int[16]; andrew@50: int no1s = 0; int no3s = 0; int no5s = 0; int no7s = 0; int no9s = 0; int no11s = 0; int no13s = 0; andrew@50: int tonic = 0; andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public int getHeresyPitch(int extension, int notePosition){ // delivers heresy pitches andrew@50: int value = getExtentionPitch(extension) % 12; andrew@50: if (notePosition == 15) value += 24; andrew@50: if (notePosition == 14) value += 36; andrew@50: if (notePosition == 13) value += 36; andrew@50: if (notePosition == 12) value += 48; andrew@50: if (notePosition == 11) value += 48; andrew@50: if (notePosition == 10) value += 48; andrew@50: if (notePosition == 9) value += 48; andrew@50: if (notePosition == 8) value += 60; andrew@50: if (notePosition == 7) value += 60; andrew@50: if (notePosition == 6) value += 60; andrew@50: if (notePosition == 5) value += 60; andrew@50: if (notePosition == 4) value += 72; andrew@50: if (notePosition == 3) value += 72; andrew@50: if (notePosition == 2) value += 72; andrew@50: if (notePosition == 1) value += 72; andrew@50: if (notePosition == 0) value += 84; andrew@50: return value; andrew@50: }*/ andrew@50: andrew@50: andrew@50: public int heresyPitchInfo(int arrayPosition){ // returns a value for checking if note required is currently playing andrew@50: int value = 0; andrew@50: if (heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){ andrew@50: if (arrayPosition == 15) value = (15-currentChord) + 24; andrew@50: if (arrayPosition == 14) value = (15-currentChord) + 36; andrew@50: if (arrayPosition == 13) value = (15-currentChord) + 43; andrew@50: if (arrayPosition == 12) value = (15-currentChord) + 50; andrew@50: if (arrayPosition == 11) value = (15-currentChord) + 51; andrew@50: if (arrayPosition == 10) value = (15-currentChord) + 58; andrew@50: if (arrayPosition == 9) value = (15-currentChord) + 65; andrew@50: if (arrayPosition == 8) value = (15-currentChord) + 67; andrew@50: if (arrayPosition == 7) value = (15-currentChord) + 70; andrew@50: if (arrayPosition == 6) value = (15-currentChord) + 72; andrew@50: if (arrayPosition == 5) value = (15-currentChord) + 74; andrew@50: if (arrayPosition == 4) value = (15-currentChord) + 75; andrew@50: if (arrayPosition == 3) value = (15-currentChord) + 77; andrew@50: if (arrayPosition == 2) value = (15-currentChord) + 79; andrew@50: if (arrayPosition == 1) value = (15-currentChord) + 82; andrew@50: if (arrayPosition == 0) value = (15-currentChord) + 84; andrew@50: } andrew@50: if (!heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){ andrew@50: if (arrayPosition == 15) value = (15-currentChord) + 24; andrew@50: if (arrayPosition == 14) value = (15-currentChord) + 36; andrew@50: if (arrayPosition == 13) value = (15-currentChord) + 43; andrew@50: if (arrayPosition == 12) value = (15-currentChord) + 50; andrew@50: if (arrayPosition == 11) value = (15-currentChord) + 52; andrew@50: if (arrayPosition == 10) value = (15-currentChord) + 59; andrew@50: if (arrayPosition == 9) value = (15-currentChord) + 66; andrew@50: if (arrayPosition == 8) value = (15-currentChord) + 71; andrew@50: if (arrayPosition == 7) value = (15-currentChord) + 74; andrew@50: if (arrayPosition == 6) value = (15-currentChord) + 78; andrew@50: if (arrayPosition == 5) value = (15-currentChord) + 83; andrew@50: if (arrayPosition == 4) value = (15-currentChord) + 75; andrew@50: if (arrayPosition == 3) value = (15-currentChord) + 77; andrew@50: if (arrayPosition == 2) value = (15-currentChord) + 79; andrew@50: if (arrayPosition == 1) value = (15-currentChord) + 82; andrew@50: if (arrayPosition == 0) value = (15-currentChord) + 84; andrew@50: } andrew@50: return value; andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void playTrackEvents(){ // initiates the playing Heresy AI logic andrew@50: andrew@50: workOutExtensions(); andrew@50: //workOutChord(); andrew@50: heresyChangeHistory(); andrew@50: VpaNoteStater(); andrew@50: // heresyVoicingArray(); andrew@50: countNoteOns(); andrew@50: andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void sendNoteEvents(){ // sends sequencer evernts to the IO section for out put to max andrew@50: for(int i = 1; i < Track.currentNumberOfTracks; i++){ andrew@50: if (tracks[i] != null ){ andrew@50: for (int ii = 0; ii < 16; ii++) { andrew@50: if (!VPA[i].VPArrayNotes[ii].played){ andrew@50: outputToMax (VPA[i].VPArrayNotes[ii].VPNotePitch, VPA[i].VPArrayNotes[ii].VPNoteVelocity, i); andrew@50: VPA[i].VPArrayNotes[ii].played = true; andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void VpaNoteStater(){ // calculates pitches based on Heresy AI voice leading and voicing tables. andrew@50: for(int i = 1; i < Track.currentNumberOfTracks; i++){ andrew@50: if (tracks[i] != null){ andrew@50: for (int ii = 0; ii < 16; ii++) { andrew@50: if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)] != null){ andrew@50: if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity != 0){ andrew@50: if (VPA[i].VPArrayNotes[ii].VPNoteOn && heresyPitchInfo(ii) != VPA[i].VPArrayNotes[ii].VPNotePitch){ andrew@50: // println("in..."); andrew@50: VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0; andrew@50: sendNote(VPA[i].VPArrayNotes[ii], i); andrew@50: if (i != 1 && i != 5) andrew@50: VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3); andrew@50: else andrew@50: VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1); andrew@50: VPA[i].VPArrayNotes[ii].VPNoteVelocity = tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity; andrew@50: sendNote(VPA[i].VPArrayNotes[ii], i); andrew@50: }else{ andrew@50: // println("in2..."); andrew@50: if (i != 1 && i != 5) andrew@50: VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3); andrew@50: else andrew@50: VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1); andrew@50: VPA[i].VPArrayNotes[ii].VPNoteVelocity = tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity; andrew@50: sendNote(VPA[i].VPArrayNotes[ii], i); andrew@50: } andrew@50: } andrew@50: if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity == 0){ andrew@50: VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0; andrew@50: sendNote(VPA[i].VPArrayNotes[ii], i); andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public void heresyVoicingArray(){ // sets the voicing array to be used for note ons andrew@50: if (!heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice135; andrew@50: if (heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice7; andrew@50: if (!heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice9; andrew@50: if (!heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice11; andrew@50: if (!heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice13; andrew@50: if (heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice79; andrew@50: if (heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice711; andrew@50: if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice713; andrew@50: if (!heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice911; andrew@50: if (!heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice913; andrew@50: if (!heresy7th && !heresy9th && heresy11th && heresy13th) hvArray = hchoice1113; andrew@50: if (heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice7911; andrew@50: if (heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice7913; andrew@50: if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice71113; andrew@50: if (!heresy7th && heresy9th && heresy11th && heresy13th) hvArray = hchoice91113; andrew@50: } andrew@50: andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void countNoteOns(){ // counts the note ons for all tracks andrew@50: for (int ii = 0; ii < 16; ii++){ andrew@50: notesOnArray[ii] = 0;} andrew@50: for(int i = 1; i < Track.currentNumberOfTracks; i++){ andrew@50: for (int ii = 0; ii < 16; ii++){ andrew@50: if (VPA[i].VPArrayNotes[ii].VPNoteOn == true) andrew@50: notesOnArray[i]++; andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public void calculateHeresyNoteExtensions(){ andrew@50: for(int tracki = 1; tracki < Track.currentNumberOfTracks; tracki++){ andrew@50: no1s = 0; no3s = 0; no5s = 0; no7s = 0; no9s = 0; no11s = 0; no13s = 0; andrew@50: andrew@50: checkIfNotesAlreadyFit(tracki); andrew@50: andrew@50: calcRemainingNotes(tracki); andrew@50: andrew@50: for (int t = 0; t < 16; t++){ andrew@50: VPA[tracki].VPArrayNotes[t].done = false; andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public void calcRemainingNotes(int tracki){ andrew@50: int counter = -1; andrew@50: int looped = 0; andrew@50: while (no1s + no3s + no5s + no7s + no9s + no11s + no13s != 0){ andrew@50: counter++; andrew@50: if (counter >= notesOnArray[tracki]){ andrew@50: counter = 0; andrew@50: looped++; andrew@50: } andrew@50: int nextExtension = hvArray[counter]; andrew@50: if(extensionNeeded(nextExtension)){ andrew@50: for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ andrew@50: if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){ andrew@50: if (extensionPossible(playingNotesi, nextExtension)){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = getHeresyPitch(nextExtension, playingNotesi); andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].done = true; andrew@50: println("got pitch " + VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch); andrew@50: // correctIfNeeded(tracki, playingNotesi, nextExtension); andrew@50: }else println("wasn't possible"); andrew@50: } andrew@50: } andrew@50: } andrew@50: if (looped > 3) { andrew@50: for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ andrew@50: if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn = false; andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -1; andrew@50: } andrew@50: } andrew@50: System.out.println("Had to break_________________"); andrew@50: break; andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* 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: boolean alreadyGotNote = false; boolean alreadyGotNotePlus12 = false; boolean alreadyGotNoteMinus12 = false; andrew@50: int pitchAverage = 0; andrew@50: for (int i = 0; i < 16; i++) andrew@50: if (i != playingNotesi){ andrew@50: if (VPA[tracki].VPArrayNotes[i].done) andrew@50: pitchAverage += VPA[tracki].VPArrayNotes[i].VPNotePitch; andrew@50: if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch) andrew@50: alreadyGotNote = true; andrew@50: if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12) andrew@50: alreadyGotNotePlus12 = true; andrew@50: if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12) andrew@50: alreadyGotNoteMinus12 = true; andrew@50: } andrew@50: if (notesOnArray[tracki]-1 > 0) andrew@50: pitchAverage = pitchAverage / (notesOnArray[tracki]-1); andrew@50: else andrew@50: pitchAverage = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch; andrew@50: boolean correctedIt = false; andrew@50: if (alreadyGotNote){ andrew@50: println("correcting note.........."); andrew@50: if (!alreadyGotNotePlus12 && pitchAverage > VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12; andrew@50: correctedIt = true; andrew@50: }else andrew@50: if (!alreadyGotNoteMinus12){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12; andrew@50: correctedIt = true; andrew@50: } andrew@50: if (!alreadyGotNoteMinus12 && pitchAverage < VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12; andrew@50: correctedIt = true; andrew@50: }else andrew@50: if (!alreadyGotNotePlus12){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12; andrew@50: correctedIt = true; andrew@50: } andrew@50: } andrew@50: if (alreadyGotNote && !correctedIt) andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -2; andrew@50: if (!alreadyGotNote || correctedIt){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80; andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].done = true; andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].played = false; andrew@50: extensionCounter(false, nextExtension); andrew@50: }else{ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80; andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].done = true; andrew@50: } andrew@50: } andrew@50: andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: andrew@50: andrew@50: /* public void checkIfNotesAlreadyFit(int tracki){ andrew@50: for (int extensioni = 0; extensioni < notesOnArray[tracki]; extensioni++){ andrew@50: boolean extensionFound = false; andrew@50: for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){ andrew@50: if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn && !VPA[tracki].VPArrayNotes[playingNotesi].done && !extensionFound && VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch >= 24){ andrew@50: if (disiredPitch(VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch, hvArray[extensioni])){ andrew@50: VPA[tracki].VPArrayNotes[playingNotesi].done = true; andrew@50: extensionFound = true; andrew@50: } andrew@50: } andrew@50: } andrew@50: if (!extensionFound){ andrew@50: extensionCounter(true, hvArray[extensioni]); andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public boolean pitchInChord(int currentPitch){ andrew@50: boolean returnValue = false; andrew@50: for (int i = 0; i < 16; i++){ andrew@50: // println("currentPitch " + currentPitch + " getHeresyPitch(hvArray[i], 5) % 12) " + (getHeresyPitch(hvArray[i], 5))); andrew@50: if (currentPitch % 12 == (getHeresyPitch(hvArray[i], 5) % 12)); andrew@50: returnValue = true; andrew@50: } andrew@50: return returnValue; andrew@50: } andrew@50: */ andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public boolean extensionNeeded(int extension){ andrew@50: boolean needed = false; andrew@50: if (extension == 1 && no1s > 0) needed = true; andrew@50: if (extension == 3 && no3s > 0) needed = true; andrew@50: if (extension == 5 && no5s > 0) needed = true; andrew@50: if (extension == 7 && no7s > 0) needed = true; andrew@50: if (extension == 9 && no9s > 0) needed = true; andrew@50: if (extension == 11 && no11s > 0) needed = true; andrew@50: if (extension == 13 && no13s > 0) needed = true; andrew@50: return needed; andrew@50: } andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public int extensionMatch(){ andrew@50: int returnValue = -1; andrew@50: for (int i = 0; i < 16; i++){ andrew@50: if( hvArray[i] == 1 && no1s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: if( hvArray[i] == 3 && no3s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: if( hvArray[i] == 5 && no5s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: if( hvArray[i] == 7 && no7s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: if( hvArray[i] == 9 && no9s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: if( hvArray[i] == 11 && no11s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: if( hvArray[i] == 13 && no13s > 0){ andrew@50: returnValue = hvArray[i]; andrew@50: break; andrew@50: } andrew@50: } andrew@50: return returnValue; andrew@50: } andrew@50: andrew@50: */ andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public boolean extensionPossible(int playingNotesi, int extentionNeeded){ andrew@50: Boolean returnValue = true; andrew@50: if (extentionNeeded != 1 && playingNotesi < 2) returnValue = false; andrew@50: if ((extentionNeeded == 5 || extentionNeeded == 7 || extentionNeeded == 1) && playingNotesi == 3) returnValue = false; andrew@50: if (!returnValue) println ("returning no on playingNotesi = " + playingNotesi + " and " + extentionNeeded); andrew@50: return returnValue; andrew@50: } andrew@50: */ andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* 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: if (pitch % 12 == getExtentionPitch(extension) % 12) andrew@50: return true; andrew@50: else return false; andrew@50: } andrew@50: */ andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public int getExtentionPitch(int extension){ // andrew@50: if (!heresyMinor){ andrew@50: if (currentChord-tonic == 1) return tritoneSystem[extension/2]+currentChord; andrew@50: if (currentChord-tonic == 7) return dom7System[extension/2]+currentChord; andrew@50: if (currentChord-tonic != 1 || currentChord-tonic != 7) return major7System[extension/2]+currentChord; andrew@50: } andrew@50: if (heresyMinor) andrew@50: return minorSystem[extension/2]+currentChord; andrew@50: else andrew@50: return -1; andrew@50: } andrew@50: */ andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: /* public void extensionCounter(boolean positive, int currentDesiredExtention){ andrew@50: if (currentDesiredExtention == 1) if (positive) no1s++; else no1s--; andrew@50: if (currentDesiredExtention == 3) if (positive) no3s++; else no3s--; andrew@50: if (currentDesiredExtention == 5) if (positive) no5s++; else no5s--; andrew@50: if (currentDesiredExtention == 7) if (positive) no7s++; else no7s--; andrew@50: if (currentDesiredExtention == 9) if (positive) no9s++; else no9s--; andrew@50: if (currentDesiredExtention == 11) if (positive) no11s++; else no11s--; andrew@50: if (currentDesiredExtention == 13) if (positive) no13s++; else no13s--; andrew@50: } andrew@50: */ andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void workOutExtensions(){ // calculates whether the performer wants chord extensions andrew@50: 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: tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] = null; andrew@50: 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: tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] = null; andrew@50: 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: tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] = null; andrew@50: 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: tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] = null; andrew@50: andrew@50: if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) andrew@50: heresy7th = true; andrew@50: if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) andrew@50: heresy7th = false; andrew@50: if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) andrew@50: heresy9th = true; andrew@50: if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) andrew@50: heresy9th = false; andrew@50: if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) andrew@50: heresy11th = true; andrew@50: if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) andrew@50: heresy11th = false; andrew@50: if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity > 0) andrew@50: heresy13th = true; andrew@50: if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0) andrew@50: heresy13th = false; andrew@50: //--- andrew@50: if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[3]) andrew@50: chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] = null; andrew@50: if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[2]) andrew@50: chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] = null; andrew@50: if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[1]) andrew@50: chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] = null; andrew@50: if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0 && trSelected == 0 && noteOnArray[0]) andrew@50: chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] = null; andrew@50: andrew@50: if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) andrew@50: heresy7th = true; andrew@50: if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) andrew@50: heresy7th = false; andrew@50: if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) andrew@50: heresy9th = true; andrew@50: if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) andrew@50: heresy9th = false; andrew@50: if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) andrew@50: heresy11th = true; andrew@50: if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) andrew@50: heresy11th = false; andrew@50: if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) andrew@50: heresy13th = true; andrew@50: if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0) andrew@50: heresy13th = false; andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void workOutChord(){ // calculates current chord and major minor tonality andrew@50: for (int i = 4; i < 16; i++) { andrew@50: if (tracks[0] != null){ andrew@50: if ((tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)].noteVelocity > 0 )|| andrew@50: (chordsTemp.sequence[i][currentPulse%(tracks[0].loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0 )){ andrew@50: currentChord = 15 - i; andrew@50: boolean iiDone = false; andrew@50: for (int ii = 0;; ii--){ andrew@50: if (ii == 0 && iiDone) andrew@50: break; andrew@50: if (currentPulse%(tracks[0].loopLength)+ii == 0) andrew@50: ii = tracks[0].loopLength+ii-1; andrew@50: if (i > 3){ andrew@50: 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: (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity == 0 )) andrew@50: break; andrew@50: 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: (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity != 0 )){ andrew@50: heresyMinor = true; andrew@50: break; andrew@50: }else andrew@50: heresyMinor = false; andrew@50: } andrew@50: iiDone = true; andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void heresyChangeHistory(){ // remembers whether the chords or extensions have changed andrew@50: if (currentChord != lastChord){ andrew@50: heresyChordChanged = true; andrew@50: lastChord = currentChord; andrew@50: heresyChange = true; andrew@50: } andrew@50: if (heresyMinor != oldHeresyMinor){ andrew@50: heresyMinorChanged = true; andrew@50: oldHeresyMinor = heresyMinor; andrew@50: heresyChange = true; andrew@50: } andrew@50: if (heresy7th != oldHeresy7th){ andrew@50: heresy7thChanged = true; andrew@50: oldHeresy7th = heresy7th; andrew@50: heresyChange = true; andrew@50: } andrew@50: if (heresy9th != oldHeresy9th){ andrew@50: heresy9thChanged = true; andrew@50: oldHeresy9th = heresy9th; andrew@50: heresyChange = true; andrew@50: } andrew@50: if (heresy11th != oldHeresy11th){ andrew@50: heresy11thChanged = true; andrew@50: oldHeresy11th = heresy11th; andrew@50: heresyChange = true; andrew@50: } andrew@50: if (heresy13th != oldHeresy13th){ andrew@50: heresy13thChanged = true; andrew@50: oldHeresy13th = heresy13th; andrew@50: heresyChange = true; andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: // the main voicing tables for chords requested andrew@50: andrew@50: // root position andrew@50: andrew@50: int[] hchoice135 = new int[] {24, 36, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 88, 91, 96}; andrew@50: int[] hchoice7 = new int[] {24, 36, 43, 48, 52, 55, 59, 64, 67, 71, 72, 76, 79, 83, 88, 95}; andrew@50: int[] hchoice9 = new int[] {24, 36, 43, 48, 50, 52, 55, 60, 62, 64, 67, 74, 76, 79, 86, 91}; andrew@50: int[] hchoice11 = new int[] {24, 36, 43, 48, 53, 55, 60, 65, 67, 72, 77, 79, 84, 89, 91, 96}; andrew@50: int[] hchoice13 = new int[] {24, 36, 43, 48, 52, 55, 57, 60, 64, 69, 72, 76, 81, 84, 88, 93}; andrew@50: int[] hchoice79 = new int[] {24, 36, 43, 48, 52, 55, 57, 59, 62, 64, 69, 71, 74, 76, 83, 86}; andrew@50: int[] hchoice711 = new int[] {24, 36, 43, 48, 53, 55, 59, 60, 65, 67, 71, 72, 77, 83, 88, 95}; //nice andrew@50: int[] hchoice713 = new int[] {24, 36, 43, 48, 52, 57, 59, 64, 69, 71, 76, 79, 81, 83, 88, 93}; andrew@50: int[] hchoice911 = new int[] {24, 36, 43, 48, 53, 55, 60, 62, 65, 67, 74, 77, 79, 86, 89, 96}; andrew@50: int[] hchoice913 = new int[] {24, 36, 43, 48, 50, 57, 60, 62, 69, 72, 74, 81, 84, 86, 93, 96}; andrew@50: int[] hchoice1113 = new int[] {24, 36, 43, 48, 52, 53, 57, 60, 64, 65, 69, 72, 77, 81, 84, 93}; //nice andrew@50: int[] hchoice7911 = new int[] {24, 36, 43, 48, 55, 62, 65, 71, 77, 79, 83, 84, 86, 89, 91, 96}; andrew@50: int[] hchoice7913 = new int[] {24, 36, 43, 48, 59, 62, 69, 71, 74, 81, 83, 84, 86, 93, 95, 96}; andrew@50: int[] hchoice71113 = new int[]{24, 36, 43, 48, 55, 59, 65, 69, 76, 77, 79, 84, 88, 89, 93, 96}; andrew@50: int[] hchoice91113 = new int[]{24, 36, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89, 96}; andrew@50: 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: andrew@50: int[] mhchoice135 = new int[] {24, 36, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 87, 91, 96};// andrew@50: int[] mhchoice7 = new int[] {24, 36, 43, 48, 51, 55, 58, 63, 67, 70, 72, 75, 79, 82, 87, 94};// andrew@50: int[] mhchoice9 = new int[] {24, 36, 43, 48, 50, 51, 55, 60, 62, 63, 67, 72, 74, 79, 86, 91};// andrew@50: int[] mhchoice11 = new int[] {24, 36, 43, 48, 51, 53, 55, 60, 63, 65, 67, 72, 77, 79, 84, 89};// andrew@50: int[] mhchoice13 = new int[] {24, 36, 43, 48, 51, 55, 57, 60, 63, 67, 69, 72, 75, 81, 84, 91};// andrew@50: int[] mhchoice79 = new int[] {24, 36, 43, 50, 51, 55, 57, 58, 62, 63, 69, 70, 74, 75, 82, 86};// andrew@50: int[] mhchoice711 = new int[] {24, 36, 43, 51, 58, 63, 65, 69, 72, 75, 77, 79, 82, 84, 89, 96};// andrew@50: int[] mhchoice713 = new int[] {24, 36, 43, 48, 55, 58, 59, 63, 69, 75, 79, 81, 82, 84, 93, 96};// andrew@50: int[] mhchoice911 = new int[] {24, 36, 43, 48, 51, 53, 62, 63, 65, 67, 74, 77, 79, 86, 89, 96};// andrew@50: int[] mhchoice913 = new int[] {24, 36, 43, 51, 57, 62, 63, 69, 74, 75, 81, 84, 86, 87, 93, 96};// andrew@50: int[] mhchoice1113 = new int[] {24, 36, 43, 53, 57, 63, 67, 72, 75, 77, 79, 81, 84, 87, 93, 96};// andrew@50: int[] mhchoice7911 = new int[] {24, 36, 43, 50, 51, 58, 65, 67, 70, 72, 74, 75, 77, 79, 82, 86};// andrew@50: int[] mhchoice7913 = new int[] {24, 36, 48, 55, 58, 62, 63, 69, 70, 74, 75, 79, 81, 84, 93, 96};// andrew@50: int[] mhchoice71113 = new int[]{24, 36, 43, 48, 53, 58, 63, 65, 69, 72, 75, 77, 81, 84, 91, 96};// andrew@50: int[] mhchoice91113 = new int[]{24, 36, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89, 96};// andrew@50: 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: andrew@50: // first inversion andrew@50: andrew@50: int[] h1choice135 = new int[] {24, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 88, 91}; andrew@50: int[] h1choice7 = new int[] {24, 36, 40, 43, 48, 52, 55, 59, 64, 67, 71, 72, 76, 79, 83, 88}; andrew@50: int[] h1choice9 = new int[] {24, 36, 38, 43, 48, 50, 52, 55, 60, 62, 64, 67, 74, 76, 79, 86}; andrew@50: int[] h1choice11 = new int[] {24, 36, 41, 43, 48, 53, 55, 60, 65, 67, 72, 77, 79, 84, 89, 91}; andrew@50: int[] h1choice13 = new int[] {24, 36, 40, 43, 48, 52, 55, 57, 60, 64, 69, 72, 76, 81, 84, 88}; andrew@50: int[] h1choice79 = new int[] {24, 36, 40, 43, 48, 52, 55, 57, 59, 62, 64, 69, 71, 74, 76, 83}; andrew@50: int[] h1choice711 = new int[] {24, 36, 41, 43, 48, 53, 55, 59, 60, 65, 67, 71, 72, 77, 83, 88}; //nice andrew@50: int[] h1choice713 = new int[] {24, 36, 40, 43, 48, 52, 57, 59, 64, 69, 71, 76, 79, 81, 83, 88}; andrew@50: int[] h1choice911 = new int[] {24, 36, 41, 43, 48, 53, 55, 60, 62, 65, 67, 74, 77, 79, 86, 89}; andrew@50: int[] h1choice913 = new int[] {24, 36, 43, 45, 48, 50, 57, 60, 62, 69, 72, 74, 81, 84, 86, 93}; andrew@50: int[] h1choice1113 = new int[] {24, 36, 40, 43, 48, 52, 53, 57, 60, 64, 65, 69, 72, 77, 81, 84}; //nice andrew@50: int[] h1choice7911 = new int[] {24, 36, 43, 48, 50, 55, 62, 65, 71, 77, 79, 83, 84, 86, 89, 91}; andrew@50: int[] h1choice7913 = new int[] {24, 36, 43, 48, 55, 59, 62, 69, 71, 74, 81, 83, 84, 86, 93, 95}; andrew@50: int[] h1choice71113 = new int[]{24, 36, 43, 48, 53, 55, 59, 65, 69, 76, 77, 79, 84, 88, 89, 93}; andrew@50: int[] h1choice91113 = new int[]{24, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89}; andrew@50: 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: andrew@50: int[] m1hchoice135 = new int[] {24, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 87, 91};// andrew@50: int[] m1hchoice7 = new int[] {24, 36, 39, 43, 48, 51, 55, 58, 63, 67, 70, 72, 75, 79, 82, 87};// andrew@50: int[] m1hchoice9 = new int[] {24, 36, 38, 43, 48, 50, 51, 55, 60, 62, 63, 67, 72, 74, 79, 86};// andrew@50: int[] m1hchoice11 = new int[] {24, 36, 39, 43, 48, 51, 53, 55, 60, 63, 65, 67, 72, 77, 79, 84};// andrew@50: int[] m1hchoice13 = new int[] {24, 36, 39, 43, 48, 51, 55, 57, 60, 63, 67, 69, 72, 75, 81, 84};// andrew@50: int[] m1hchoice79 = new int[] {24, 36, 39, 43, 50, 51, 55, 57, 58, 62, 63, 69, 70, 74, 75, 82};// andrew@50: int[] m1hchoice711 = new int[] {24, 36, 43, 46, 51, 58, 63, 65, 69, 72, 75, 77, 79, 82, 84, 89};// andrew@50: int[] m1hchoice713 = new int[] {24, 36, 43, 46, 48, 55, 58, 59, 63, 69, 75, 79, 81, 82, 84, 93};// andrew@50: int[] m1hchoice911 = new int[] {24, 36, 39, 43, 48, 51, 53, 62, 63, 65, 67, 74, 77, 79, 86, 89};// andrew@50: int[] m1hchoice913 = new int[] {24, 36, 43, 48, 51, 57, 62, 63, 69, 74, 75, 81, 84, 86, 87, 93};// andrew@50: int[] m1hchoice1113 = new int[] {24, 36, 43, 45, 53, 57, 63, 67, 72, 75, 77, 79, 81, 84, 87, 93};// andrew@50: int[] m1hchoice7911 = new int[] {24, 36, 39, 43, 50, 51, 58, 65, 67, 70, 72, 74, 75, 77, 79, 82};// andrew@50: int[] m1hchoice7913 = new int[] {24, 36, 43, 48, 55, 58, 62, 63, 69, 70, 74, 75, 79, 81, 84, 93};// andrew@50: int[] m1hchoice71113 = new int[]{24, 36, 43, 46, 48, 53, 58, 63, 65, 69, 72, 75, 77, 81, 84, 91};// andrew@50: int[] m1hchoice91113 = new int[]{24, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81, 89};// andrew@50: 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: andrew@50: // second inversion andrew@50: andrew@50: int[] h2choice135 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 60, 64, 67, 72, 76, 79, 84, 88}; andrew@50: int[] h2choice7 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 59, 64, 67, 71, 72, 76, 79, 83}; andrew@50: int[] h2choice9 = new int[] {24, 31, 36, 38, 43, 48, 50, 52, 55, 60, 62, 64, 67, 74, 76, 79}; andrew@50: int[] h2choice11 = new int[] {24, 31, 36, 41, 43, 48, 53, 55, 60, 65, 67, 72, 77, 79, 84, 89}; andrew@50: int[] h2choice13 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 57, 60, 64, 69, 72, 76, 81, 84}; andrew@50: int[] h2choice79 = new int[] {24, 31, 36, 40, 43, 48, 52, 55, 57, 59, 62, 64, 69, 71, 74, 76}; andrew@50: int[] h2choice711 = new int[] {24, 31, 36, 41, 43, 48, 53, 55, 59, 60, 65, 67, 71, 72, 77, 83}; //nice andrew@50: int[] h2choice713 = new int[] {24, 31, 36, 40, 43, 48, 52, 57, 59, 64, 69, 71, 76, 79, 81, 83}; andrew@50: int[] h2choice911 = new int[] {24, 31, 36, 41, 43, 48, 53, 55, 60, 62, 65, 67, 74, 77, 79, 86}; andrew@50: int[] h2choice913 = new int[] {24, 31, 36, 43, 45, 48, 50, 57, 60, 62, 69, 72, 74, 81, 84, 86}; andrew@50: int[] h2choice1113 = new int[] {24, 31, 36, 40, 43, 48, 52, 53, 57, 60, 64, 65, 69, 72, 77, 81}; //nice andrew@50: int[] h2choice7911 = new int[] {24, 31, 36, 43, 48, 50, 55, 62, 65, 71, 77, 79, 83, 84, 86, 89}; andrew@50: int[] h2choice7913 = new int[] {24, 31, 36, 43, 48, 55, 59, 62, 69, 71, 74, 81, 83, 84, 86, 93}; andrew@50: int[] h2choice71113 = new int[]{24, 31, 36, 43, 48, 53, 55, 59, 65, 69, 76, 77, 79, 84, 88, 89}; andrew@50: int[] h2choice91113 = new int[]{24, 31, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81}; andrew@50: 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: andrew@50: int[] m2hchoice135 = new int[] {24, 31, 36, 39, 43, 48, 51, 55, 60, 63, 67, 72, 75, 79, 84, 87};// andrew@50: int[] m2hchoice7 = new int[] {24, 31, 36, 39, 43, 48, 51, 55, 58, 63, 67, 70, 72, 75, 79, 82};// andrew@50: int[] m2hchoice9 = new int[] {24, 31, 36, 38, 43, 48, 50, 51, 55, 60, 62, 63, 67, 72, 74, 79};// andrew@50: int[] m2hchoice11 = new int[] {24, 31, 36, 39, 43, 48, 51, 53, 55, 60, 63, 65, 67, 72, 77, 79};// andrew@50: int[] m2hchoice13 = new int[] {24, 31, 36, 39, 43, 48, 51, 55, 57, 60, 63, 67, 69, 72, 75, 81};// andrew@50: int[] m2hchoice79 = new int[] {24, 31, 36, 39, 43, 50, 51, 55, 57, 58, 62, 63, 69, 70, 74, 75};// andrew@50: int[] m2hchoice711 = new int[] {24, 31, 36, 43, 46, 51, 58, 63, 65, 69, 72, 75, 77, 79, 82, 84};// andrew@50: int[] m2hchoice713 = new int[] {24, 31, 36, 43, 46, 48, 55, 58, 59, 63, 69, 75, 79, 81, 82, 84};// andrew@50: int[] m2hchoice911 = new int[] {24, 31, 36, 39, 43, 48, 51, 53, 62, 63, 65, 67, 74, 77, 79, 86};// andrew@50: int[] m2hchoice913 = new int[] {24, 31, 36, 43, 48, 51, 57, 62, 63, 69, 74, 75, 81, 84, 86, 87};// andrew@50: int[] m2hchoice1113 = new int[] {24, 31, 36, 43, 45, 53, 57, 63, 67, 72, 75, 77, 79, 81, 84, 87};// andrew@50: int[] m2hchoice7911 = new int[] {24, 31, 36, 39, 43, 50, 51, 58, 65, 67, 70, 72, 74, 75, 77, 79};// andrew@50: int[] m2hchoice7913 = new int[] {24, 31, 36, 43, 48, 55, 58, 62, 63, 69, 70, 74, 75, 79, 81, 84};// andrew@50: int[] m2hchoice71113 = new int[]{24, 31, 36, 43, 46, 48, 53, 58, 63, 65, 69, 72, 75, 77, 81, 84};// andrew@50: int[] m2hchoice91113 = new int[]{24, 31, 36, 41, 48, 50, 53, 57, 60, 62, 65, 69, 72, 74, 77, 81};// andrew@50: 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: andrew@50: int[] hvArray; andrew@50: int[] minorSystem = new int[] {0, 3, 7, 10, 14, 17, 21}; andrew@50: int[] major7System = new int[] {0, 4, 7, 11, 14, 18, 21}; andrew@50: int[] dom7System = new int[] {0, 4, 7, 10, 14, 17, 21}; andrew@50: int[] tritoneSystem = new int[] {0, 4, 7, 10, 14, 18, 21}; andrew@50: andrew@50: public int heresyPitch(int arrayPosition, int heresyChannel){ // calculates the pitch value to be returned for playback. andrew@50: boolean m = heresyMinor; andrew@50: boolean e7 = heresy7th; andrew@50: boolean e9 = heresy9th; andrew@50: boolean e11 = heresy11th; andrew@50: boolean e13 = heresy13th; andrew@50: int returnInt = 0; andrew@50: if ((currentChord % 12) > -1 && (currentChord % 12) < 4){ andrew@50: if (!m && !e7 && !e9 && !e11 && !e13) returnInt = hchoice135[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && !e11 && !e13) returnInt = hchoice7[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && !e11 && !e13) returnInt = hchoice9[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && e11 && !e13) returnInt = hchoice11[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && !e11 && e13) returnInt = hchoice13[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && !e11 && !e13) returnInt = hchoice79[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && e11 && !e13) returnInt = hchoice711[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && !e11 && e13) returnInt = hchoice713[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && e11 && !e13) returnInt = hchoice911[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && !e11 && e13) returnInt = hchoice913[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && e11 && e13) returnInt = hchoice1113[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && e11 && !e13) returnInt = hchoice7911[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && !e11 && e13) returnInt = hchoice7913[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && e11 && e13) returnInt = hchoice71113[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && e11 && e13) returnInt = hchoice91113[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && e11 && e13) returnInt = hchoice791113[15 - arrayPosition]; andrew@50: andrew@50: if (m && !e7 && !e9 && !e11 && !e13) returnInt = mhchoice135[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && !e11 && !e13) returnInt = mhchoice7[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && !e11 && !e13) returnInt = mhchoice9[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && e11 && !e13) returnInt = mhchoice11[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && !e11 && e13) returnInt = mhchoice13[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && !e11 && !e13) returnInt = mhchoice79[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && e11 && !e13) returnInt = mhchoice711[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && !e11 && e13) returnInt = mhchoice713[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && e11 && !e13) returnInt = mhchoice911[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && !e11 && e13) returnInt = mhchoice913[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && e11 && e13) returnInt = mhchoice1113[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && e11 && !e13) returnInt = mhchoice7911[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && !e11 && e13) returnInt = mhchoice7913[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && e11 && e13) returnInt = mhchoice71113[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && e11 && e13) returnInt = mhchoice91113[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && e11 && e13) returnInt = mhchoice791113[15 - arrayPosition]; andrew@50: } andrew@50: andrew@50: if ((currentChord % 12) > 3 && (currentChord % 12) < 8){ andrew@50: if (!m && !e7 && !e9 && !e11 && !e13) returnInt = h1choice135[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && !e11 && !e13) returnInt = h1choice7[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && !e11 && !e13) returnInt = h1choice9[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && e11 && !e13) returnInt = h1choice11[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && !e11 && e13) returnInt = h1choice13[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && !e11 && !e13) returnInt = h1choice79[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && e11 && !e13) returnInt = h1choice711[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && !e11 && e13) returnInt = h1choice713[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && e11 && !e13) returnInt = h1choice911[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && !e11 && e13) returnInt = h1choice913[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && e11 && e13) returnInt = h1choice1113[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && e11 && !e13) returnInt = h1choice7911[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && !e11 && e13) returnInt = h1choice7913[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && e11 && e13) returnInt = h1choice71113[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && e11 && e13) returnInt = h1choice91113[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && e11 && e13) returnInt = h1choice791113[15 - arrayPosition]; andrew@50: andrew@50: if (m && !e7 && !e9 && !e11 && !e13) returnInt = m1hchoice135[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && !e11 && !e13) returnInt = m1hchoice7[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && !e11 && !e13) returnInt = m1hchoice9[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && e11 && !e13) returnInt = m1hchoice11[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && !e11 && e13) returnInt = m1hchoice13[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && !e11 && !e13) returnInt = m1hchoice79[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && e11 && !e13) returnInt = m1hchoice711[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && !e11 && e13) returnInt = m1hchoice713[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && e11 && !e13) returnInt = m1hchoice911[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && !e11 && e13) returnInt = m1hchoice913[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && e11 && e13) returnInt = m1hchoice1113[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && e11 && !e13) returnInt = m1hchoice7911[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && !e11 && e13) returnInt = m1hchoice7913[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && e11 && e13) returnInt = m1hchoice71113[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && e11 && e13) returnInt = m1hchoice91113[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && e11 && e13) returnInt = m1hchoice791113[15 - arrayPosition]; andrew@50: } andrew@50: andrew@50: if ((currentChord % 12) > 7 && (currentChord % 12) < 12){ andrew@50: if (!m && !e7 && !e9 && !e11 && !e13) returnInt = h2choice135[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && !e11 && !e13) returnInt = h2choice7[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && !e11 && !e13) returnInt = h2choice9[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && e11 && !e13) returnInt = h2choice11[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && !e11 && e13) returnInt = h2choice13[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && !e11 && !e13) returnInt = h2choice79[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && e11 && !e13) returnInt = h2choice711[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && !e11 && e13) returnInt = h2choice713[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && e11 && !e13) returnInt = h2choice911[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && !e11 && e13) returnInt = h2choice913[15 - arrayPosition]; andrew@50: if (!m && !e7 && !e9 && e11 && e13) returnInt = h2choice1113[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && e11 && !e13) returnInt = h2choice7911[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && !e11 && e13) returnInt = h2choice7913[15 - arrayPosition]; andrew@50: if (!m && e7 && !e9 && e11 && e13) returnInt = h2choice71113[15 - arrayPosition]; andrew@50: if (!m && !e7 && e9 && e11 && e13) returnInt = h2choice91113[15 - arrayPosition]; andrew@50: if (!m && e7 && e9 && e11 && e13) returnInt = h2choice791113[15 - arrayPosition]; andrew@50: andrew@50: if (m && !e7 && !e9 && !e11 && !e13) returnInt = m2hchoice135[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && !e11 && !e13) returnInt = m2hchoice7[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && !e11 && !e13) returnInt = m2hchoice9[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && e11 && !e13) returnInt = m2hchoice11[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && !e11 && e13) returnInt = m2hchoice13[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && !e11 && !e13) returnInt = m2hchoice79[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && e11 && !e13) returnInt = m2hchoice711[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && !e11 && e13) returnInt = m2hchoice713[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && e11 && !e13) returnInt = m2hchoice911[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && !e11 && e13) returnInt = m2hchoice913[15 - arrayPosition]; andrew@50: if (m && !e7 && !e9 && e11 && e13) returnInt = m2hchoice1113[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && e11 && !e13) returnInt = m2hchoice7911[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && !e11 && e13) returnInt = m2hchoice7913[15 - arrayPosition]; andrew@50: if (m && e7 && !e9 && e11 && e13) returnInt = m2hchoice71113[15 - arrayPosition]; andrew@50: if (m && !e7 && e9 && e11 && e13) returnInt = m2hchoice91113[15 - arrayPosition]; andrew@50: if (m && e7 && e9 && e11 && e13) returnInt = m2hchoice791113[15 - arrayPosition]; andrew@50: } andrew@50: andrew@50: if (heresyDom && returnInt % 12 == 11) andrew@50: returnInt--; andrew@50: returnInt = currentChord + returnInt; andrew@50: andrew@50: // if (heresyChannel == 1 || heresyChannel == 5) andrew@50: // returnInt = 15 - arrayPosition + 36; andrew@50: andrew@50: andrew@50: andrew@50: return returnInt; andrew@50: } andrew@50: andrew@50: andrew@50: public void sendNote(VPNote note, int channel){ // send note function gathers info to output to max andrew@50: outputToMax(note.VPNotePitch, note.VPNoteVelocity, channel); andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: 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: String noteOut = ""; andrew@50: if (!tracks[channel].mute){ andrew@50: if (tracks[channel].ducking){ andrew@50: if (velocity != 0){ andrew@50: noteOut = ("" + note + " " + velocity + " " + (channel+8)); andrew@50: } andrew@50: if (velocity == 0 && !tracks[channel].cycled){ andrew@50: noteOut = ("" + note + " " + velocity + " " + (channel+8)); andrew@50: OscMessage message = new OscMessage("/pitch_vel_chan"); andrew@50: message.add(noteOut); andrew@50: oscP5return.send(message, ableton); andrew@50: link.output(noteOut); andrew@50: noteOut = ("" + note + " " + velocity + " " + channel); andrew@50: } andrew@50: if (velocity == 0 && tracks[channel].cycled){ andrew@50: noteOut = ("" + note + " " + velocity + " " + (channel+8)); andrew@50: } andrew@50: } andrew@50: if (!tracks[channel].ducking){ andrew@50: if (velocity != 0){ andrew@50: noteOut = ("" + note + " " + velocity + " " + channel); andrew@50: } andrew@50: if (velocity == 0 && !tracks[channel].cycled){ andrew@50: noteOut = ("" + note + " " + velocity + " " + (channel+8)); andrew@50: OscMessage message = new OscMessage("/pitch_vel_chan"); andrew@50: message.add(noteOut); andrew@50: oscP5return.send(message, ableton); andrew@50: link.output(noteOut); andrew@50: noteOut = ("" + note + " " + velocity + " " + channel); andrew@50: } andrew@50: if (velocity == 0 && tracks[channel].cycled){ andrew@50: noteOut = ("" + note + " " + velocity + " " + channel); andrew@50: } andrew@50: } andrew@50: link.output(noteOut); andrew@50: OscMessage message = new OscMessage("/pitch_vel_chan"); andrew@50: message.add(noteOut); andrew@50: oscP5return.send(message, ableton); andrew@50: andrew@50: } andrew@50: if (tracks[channel].mute){ andrew@50: if (velocity == 0 && !tracks[channel].cycled){ andrew@50: noteOut = ("" + note + " " + velocity + " " + (channel+8)); andrew@50: link.output(noteOut); andrew@50: OscMessage message = new OscMessage("/pitch_vel_chan"); andrew@50: message.add(noteOut); andrew@50: oscP5return.send(message, ableton); andrew@50: noteOut = ("" + note + " " + velocity + " " + channel); andrew@50: OscMessage message2 = new OscMessage("/pitch_vel_chan"); andrew@50: message2.add(noteOut); andrew@50: oscP5return.send(message, ableton); andrew@50: link.output(noteOut); andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void mouseDragged(){ // not used andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void mouseReleased(){ // not used andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void mousePressed(){ // not used andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void keyPressed() { // takes keyboard input andrew@50: if (key == 'c' || key == 'C') { andrew@50: chordSelecter = !chordSelecter; andrew@50: if (!chordSelecter) andrew@50: trSelected = lastTrack; andrew@50: else{ andrew@50: lastTrack = trSelected; andrew@50: trSelected = 0; andrew@50: andrew@50: } andrew@50: } andrew@50: andrew@50: if (key == ' ') { andrew@50: if (trSelected != 0){ andrew@50: for (int i = 0; i < 16; i++){ andrew@50: noteOnArray[i] = false; andrew@50: finishNote(i); andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: andrew@50: if (trSelected != 0){ andrew@50: for (int i = 24; i < 109; i++) andrew@50: outputToMax(i, 0, trSelected); andrew@50: } andrew@50: tracks[trSelected] = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); andrew@50: imgNotes = null; andrew@50: } andrew@50: andrew@50: if (trSelected == 0){ andrew@50: for (int i = 0; i < 16; i++){ andrew@50: noteOnArray[i] = false; andrew@50: finishNote(i); andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: heresyMinor = false; andrew@50: heresy7th = false; andrew@50: heresy9th = false; andrew@50: heresy11th = false; andrew@50: heresy13th = false; andrew@50: chordsTemp = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); andrew@50: imgNotes = null; andrew@50: } andrew@50: } andrew@50: andrew@50: if (key == 'p' || key == 'P') { andrew@50: for (int i = 0; i < 16; i++){ andrew@50: for (int ii = 24; ii < 109; ii++) andrew@50: outputToMax(ii, 0, trSelected); andrew@50: noteOnArray[i] = false; andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: } andrew@50: andrew@50: if (key == 'd' || key == 'D') { andrew@50: if (trSelected != 0 && trSelected != 1){ andrew@50: tracks[trSelected].ducking = !tracks[trSelected].ducking; andrew@50: tracks[trSelected].cycled = false; andrew@50: tracks[trSelected].cycledPosition = currentPulse%tracks[trSelected].loopLength; andrew@50: } andrew@50: } andrew@50: andrew@50: if (key == 'w' || key == 'W') { andrew@50: andrew@50: trSelected = 0; andrew@50: andrew@50: for (int i = 0; i < 16; i++){ andrew@50: noteOnArray[i] = false; andrew@50: finishNoteCutOff(i); andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: heresyMinor = false; andrew@50: heresy7th = false; andrew@50: heresy9th = false; andrew@50: heresy11th = false; andrew@50: heresy13th = false; andrew@50: andrew@50: tracks[trSelected] = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); andrew@50: chordsTemp = new Track(tracks[trSelected].name, true, tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false); andrew@50: imgNotes = null; andrew@50: } andrew@50: andrew@50: if (key == 'q' || key == 'Q'){ andrew@50: quantizeValueIn = true; andrew@50: sendToScreen(tracks[trSelected].name + " quantize?"); andrew@50: } andrew@50: andrew@50: if (key == 'x' || key == 'X'){ andrew@50: clickTrackOn = !clickTrackOn; andrew@50: } andrew@50: andrew@50: if (key == 'e' || key == 'E'){ andrew@50: eraseOn = !eraseOn; andrew@50: if (!eraseOn) imgNotes = null; andrew@50: } andrew@50: andrew@50: if (key == 'r' || key == 'R'){ andrew@50: imgNotes = null; andrew@50: } andrew@50: andrew@50: if (key == 'l' || key == 'L'){ andrew@50: loopLengthValueIn = true; andrew@50: sendToScreen(tracks[trSelected].name + " loop length?"); andrew@50: } andrew@50: andrew@50: if (key == 'm' || key == 'M'){ andrew@50: if (trSelected != 0){ andrew@50: muteValueIn = true; andrew@50: if (!tracks[trSelected].mute) andrew@50: sendToScreen(tracks[trSelected].name + " mute in?"); andrew@50: if (tracks[trSelected].mute) andrew@50: sendToScreen(tracks[trSelected].name + " unmute in?"); andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: if (key == '1') numberKey(1); andrew@50: if (key == '2') numberKey(2); andrew@50: if (key == '3') numberKey(3); andrew@50: if (key == '4') numberKey(4); andrew@50: if (key == '5') numberKey(5); andrew@50: if (key == '6') numberKey(6); andrew@50: if (key == '7') numberKey(7); andrew@50: if (key == '8') numberKey(8); andrew@50: if (key == '9') numberKey(9); andrew@50: if (key == '0') numberKey(0); andrew@50: andrew@50: if (key == CODED) { andrew@50: if (keyCode == UP && trSelected < Track.currentNumberOfTracks-1) andrew@50: trSelected++; andrew@50: if (keyCode == DOWN && trSelected > 1) { andrew@50: trSelected--; andrew@50: } andrew@50: } andrew@50: andrew@50: if (key == 's' || key == 'S'){ andrew@50: for (int i = 0; i < 16; i++){ andrew@50: for (int ii = 0; ii < tracks[0].loopLength; ii++){ andrew@50: if (chordsTemp.sequence[i][ii] != null) andrew@50: tracks[0].sequence[i][ii] = chordsTemp.sequence[i][ii]; andrew@50: } andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void numberKey(int input){ // if a number is enterd, this method works out what to do with it andrew@50: if (quantizeValueIn == true) andrew@50: if (input == 1 || input == 2 || input == 4 || input == 8 || input == 0){ andrew@50: tracks[trSelected].quantize = input; andrew@50: quantizeValueIn = false; andrew@50: aniOut = true; andrew@50: } andrew@50: andrew@50: if (loopLengthValueIn == true){ andrew@50: if (input >= 1 && input <= 8 ){ andrew@50: Track tempTrack = new Track(tracks[trSelected].name, tracks[trSelected].polyphonic, (input * loopLength / 2), tracks[trSelected].quantize, false, false); andrew@50: NoteEvent tempNote; andrew@50: andrew@50: for (int i = 0; i < 16; i++){ andrew@50: if (tempTrack.loopLength >= tracks[trSelected].loopLength){ andrew@50: for (int ii = 0; ii < tracks[trSelected].loopLength; ii++){ andrew@50: tempTrack.sequence[i][ii] = tracks[trSelected].sequence[i][ii]; andrew@50: } andrew@50: }else{ andrew@50: for (int ii = 0; ii < tempTrack.loopLength; ii++){ andrew@50: tempTrack.sequence[i][ii] = tracks[trSelected].sequence[i][ii]; andrew@50: } andrew@50: } andrew@50: } andrew@50: tracks[trSelected] = tempTrack; andrew@50: for (int i = 0; i < 16; i++) andrew@50: if (noteOnArray[i] = true){ andrew@50: noteOnArray[i] = false; andrew@50: finishNoteCutOff(i); andrew@50: displayNoteOnArray[i] = false; andrew@50: } andrew@50: andrew@50: andrew@50: loopLengthValueIn = false; andrew@50: aniOut = true; andrew@50: if (trSelected ==0){ andrew@50: Track tempTrack2 = new Track(chordsTemp.name, chordsTemp.polyphonic, (input * loopLength / 2), chordsTemp.quantize, false, false); andrew@50: NoteEvent tempNote2; andrew@50: andrew@50: for (int i = 0; i < 16; i++){ andrew@50: if (tempTrack2.loopLength >= chordsTemp.loopLength){ andrew@50: for (int ii = 0; ii < chordsTemp.loopLength; ii++){ andrew@50: tempTrack2.sequence[i][ii] = chordsTemp.sequence[i][ii]; andrew@50: } andrew@50: }else{ andrew@50: for (int ii = 0; ii < tempTrack2.loopLength; ii++){ andrew@50: tempTrack2.sequence[i][ii] = chordsTemp.sequence[i][ii]; andrew@50: } andrew@50: } andrew@50: } andrew@50: chordsTemp = tempTrack2; andrew@50: } andrew@50: imgNotes = null; andrew@50: } andrew@50: } andrew@50: andrew@50: if (muteValueIn == true){ andrew@50: tracks[trSelected].muteIn = bar + input; andrew@50: muteValueIn = false; andrew@50: tracks[trSelected].muteDone = false; andrew@50: aniOut = true; andrew@50: } andrew@50: andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void sendToScreen(String name){ // prepares a question for asking the user and turns the question on andrew@50: andrew@50: screenQuestion = name; andrew@50: screenAni = 0; andrew@50: haveQuestion = true; andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void checkCycled(){ // checks whether after ducking or muting all note offs are played. andrew@50: for (int i = 1; i < Track.currentNumberOfTracks; i++) andrew@50: if (tracks[i].cycled == false) andrew@50: if (tracks[i].cycledPosition-1 == currentPulse%tracks[trSelected].loopLength) andrew@50: tracks[i].cycled = true; andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: andrew@50: public void checkForMutes(){ // looks for mute / unmuted changes in tracks andrew@50: for (int i = 1; i < Track.currentNumberOfTracks; i++) andrew@50: if (tracks[i].muteIn == bar && !tracks[i].muteDone){ andrew@50: tracks[i].mute = !tracks[i].mute; andrew@50: tracks[i].muteDone = true; andrew@50: tracks[trSelected].cycled = false; andrew@50: tracks[trSelected].cycledPosition = currentPulse%tracks[trSelected].loopLength; andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void writeQuestion(){ // animates screen questions andrew@50: andrew@50: if (screenAni < 10 && !aniOut){ andrew@50: screenAni++; andrew@50: } andrew@50: andrew@50: if (screenAni > 0 && aniOut){ andrew@50: screenAni--; andrew@50: } andrew@50: andrew@50: if (screenAni == 0){ andrew@50: haveQuestion = false; andrew@50: aniOut = false; andrew@50: } andrew@50: andrew@50: fill(255,0,0, screenAni*12); andrew@50: textSize((11-screenAni)*40); andrew@50: text(screenQuestion, (screenAni*50)-200,(100-screenAni*10)+150); andrew@50: andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: public void oscEvent(OscMessage theOscMessage) { // recieves osc messages from openFrameworks andrew@50: println("osc message : " + theOscMessage); andrew@50: if(theOscMessage.checkAddrPattern("/test")==true) { andrew@50: println("i1 : " + theOscMessage.get(1).intValue() + " i2 : " + theOscMessage.get(2).intValue() + " i3 : " + theOscMessage.get(3).intValue() + " i4 : " + theOscMessage.get(4).intValue()); andrew@50: clickTrack = false; andrew@50: String stringValue = theOscMessage.get(0).stringValue(); andrew@50: int firstValue = theOscMessage.get(1).intValue(); andrew@50: int secondValue = theOscMessage.get(2).intValue(); andrew@50: int thirdValue = theOscMessage.get(3).intValue(); //velocity andrew@50: int fourthValue = theOscMessage.get(4).intValue(); //channel andrew@50: if (secondValue == 1){ andrew@50: noteOnArray[firstValue] = true; andrew@50: writeNote(firstValue, thirdValue, fourthValue); andrew@50: } andrew@50: else{ andrew@50: noteOnArray[firstValue] = false; andrew@50: writeNote(firstValue, 0, fourthValue); andrew@50: } andrew@50: } andrew@50: if(theOscMessage.checkAddrPattern("/chord")==true) { andrew@50: chordCalc(); andrew@50: // writeNote(15, 80, 6); andrew@50: writeNote(14, 80, 6); andrew@50: writeNote(13, 80, 6); andrew@50: writeNote(12, 80, 6); andrew@50: writeNote(11, 80, 6); andrew@50: writeNote(10, 80, 6); andrew@50: writeNote(9, 80, 6); andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: class VPArray{ // the virtual playing array for Heresy AI to play with andrew@50: andrew@50: VPNote[] VPArrayNotes; andrew@50: andrew@50: public VPArray(){ andrew@50: VPArrayNotes = new VPNote[16]; andrew@50: for (int i = 0; i < 16; i++) andrew@50: VPArrayNotes[i] = new VPNote(); andrew@50: } andrew@50: } andrew@50: andrew@50: class VPNote{ andrew@50: andrew@50: boolean played; andrew@50: boolean VPNoteOn; andrew@50: boolean done; andrew@50: int extension; andrew@50: int VPNotePitch; andrew@50: int VPNoteVelocity; andrew@50: andrew@50: public VPNote(){ andrew@50: VPNoteOn = false; andrew@50: played = true; andrew@50: extension = 0; andrew@50: VPNotePitch = 0; andrew@50: VPNoteVelocity = 0; andrew@50: } andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: andrew@50: public void chordCalc(){ andrew@50: barCounter++; andrew@50: if (barCounter % 4 == 0 || ((currentChord == 1 || currentChord == 5 || currentChord == 7) && barCounter % 4 == 3)){ andrew@50: tonicNeeded = true; andrew@50: print(" tonic needed " + (barCounter % 4)); andrew@50: } andrew@50: else tonicNeeded = false; andrew@50: chooseChord(); andrew@50: } andrew@50: andrew@50: public void chooseChord(){ andrew@50: andrew@50: int i = 0; andrew@50: for (; i < crneeded; i++){ andrew@50: if (chordChoicesArray[i].chordNote == currentChord && chordChoicesArray[i].minor == heresyMinor) andrew@50: break; andrew@50: } andrew@50: if (currentChord == 1 && heresyDom) andrew@50: i = 16; andrew@50: if (tonicNeeded && i != 24){ andrew@50: int gotOne = -1; andrew@50: int gotTwo = -1; andrew@50: if (chordChoicesArray[i].optionArray[0].chordOption == 0 && chordChoicesArray[i].optionArray[1].chordOption == 0 && PApplet.parseInt(random(2)) == 0) andrew@50: chosenChord (i, chordChoicesArray[i].optionArray[1].chordOption); andrew@50: else if andrew@50: (chordChoicesArray[i].optionArray[0].chordOption == 0 && chordChoicesArray[i].optionArray[1].chordOption != 0) andrew@50: chosenChord (i, chordChoicesArray[i].optionArray[0].chordOption); andrew@50: else andrew@50: chosenChord (i, PApplet.parseInt(random(chordChoicesArray[i].slots))); andrew@50: } andrew@50: else if (i != 24){ andrew@50: chosenChord(i, PApplet.parseInt(random(chordChoicesArray[i].slots))); andrew@50: }else{ andrew@50: currentChord = lastChordChange; andrew@50: heresyMinor = lastMinor; andrew@50: } andrew@50: println(" chord selected : " + currentChord + " minor:" + heresyMinor); andrew@50: } andrew@50: andrew@50: public void chosenChord(int p, int p2){ andrew@50: lastChordChange = currentChord; andrew@50: lastMinor = heresyMinor; andrew@50: // println("p: " + p + " p2 : " + p2); andrew@50: currentChord = chordChoicesArray[p].optionArray[p2].chordOption; andrew@50: heresyMinor = chordChoicesArray[p].optionArray[p2].minor; andrew@50: if (PApplet.parseInt(random(4)) == 0) andrew@50: heresy7th = true; andrew@50: else andrew@50: heresy7th = false; andrew@50: if (PApplet.parseInt(random(4)) == 0) andrew@50: heresy9th = true; andrew@50: else andrew@50: heresy9th = false; andrew@50: if (PApplet.parseInt(random(4)) == 0) andrew@50: heresy11th = true; andrew@50: else andrew@50: heresy11th = false; andrew@50: andrew@50: andrew@50: } andrew@50: andrew@50: andrew@50: andrew@50: class chordChoices{ andrew@50: int chordNote; andrew@50: boolean minor; andrew@50: ChordChoice[] optionArray; andrew@50: int slots; andrew@50: andrew@50: public chordChoices(int chordNote, boolean minor, int slotsNeeded){ andrew@50: this.chordNote = chordNote; andrew@50: this.minor = minor; andrew@50: optionArray = new ChordChoice[slotsNeeded]; andrew@50: slots = slotsNeeded; andrew@50: } andrew@50: } andrew@50: andrew@50: class ChordChoice{ andrew@50: int chordOption; andrew@50: boolean minor, h7th, h9th, h11th, h13th, dom; andrew@50: andrew@50: public ChordChoice(int chordOption, boolean minor, boolean dom, boolean h7th, boolean h9th, boolean h11th, boolean h13th){ andrew@50: this.chordOption = chordOption; andrew@50: this.minor = minor; andrew@50: this.dom = dom; andrew@50: this.h7th = h7th; andrew@50: this.h9th = h9th; andrew@50: this.h11th = h11th; andrew@50: this.h13th = h13th; andrew@50: } andrew@50: } andrew@50: andrew@50: //void stuff(){ andrew@50: chordChoices[] chordChoicesArray = new chordChoices[crneeded]; andrew@50: andrew@50: public void markovStuff(){ andrew@50: chordChoicesArray[0] = new chordChoices(0, false, 13); andrew@50: chordChoicesArray[0].optionArray[0] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[1] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[2] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[6] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[7] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[8] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[9] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[10] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[11] = new ChordChoice(10, false, true, true, true, true, true); andrew@50: chordChoicesArray[0].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[1] = new chordChoices(0, true, 14); andrew@50: chordChoicesArray[1].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[1] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[2] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[3] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[6] = new ChordChoice(6, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[11] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: chordChoicesArray[1].optionArray[13] = new ChordChoice(11, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[2] = new chordChoices(2, false, 9); andrew@50: chordChoicesArray[2].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[1] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[2] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[5] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[6] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[7] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[2].optionArray[8] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[3] = new chordChoices(2, true, 13); andrew@50: chordChoicesArray[3].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[2] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[4] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[11] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[3].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[4] = new chordChoices(4, false, 4); andrew@50: chordChoicesArray[4].optionArray[0] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[4].optionArray[1] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[4].optionArray[2] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[4].optionArray[3] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[5] = new chordChoices(4, true, 13); andrew@50: chordChoicesArray[5].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[4] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[5] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[7] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[11] = new ChordChoice(11, false, false, true, true, true, true); andrew@50: chordChoicesArray[5].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[6] = new chordChoices(5, false, 14); andrew@50: chordChoicesArray[6].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[2] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[3] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[4] = new ChordChoice(4, false, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[6] = new ChordChoice(6, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[11] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: chordChoicesArray[6].optionArray[13] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[7] = new chordChoices(5, true, 15); andrew@50: chordChoicesArray[7].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[4] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[6] = new ChordChoice(4, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[7] = new ChordChoice(6, true, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[9] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[13] = new ChordChoice(11, false, false, true, true, true, true); andrew@50: chordChoicesArray[7].optionArray[14] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[8] = new chordChoices(7, true, 14); andrew@50: chordChoicesArray[8].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[3] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[4] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[6] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[9] = new ChordChoice(6, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[8].optionArray[13] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[9] = new chordChoices(7, false, 10); andrew@50: chordChoicesArray[9].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[4] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[5] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[6] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[9].optionArray[9] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[10] = new chordChoices(9, true, 13); andrew@50: chordChoicesArray[10].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[4] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[6] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[9] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[10] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[10].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[11] = new chordChoices(11, false, 6); andrew@50: chordChoicesArray[11].optionArray[0] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[11].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[11].optionArray[2] = new ChordChoice(1, true, false, true, true, true, true); andrew@50: chordChoicesArray[11].optionArray[3] = new ChordChoice(1, false, false, true, true, true, true); andrew@50: chordChoicesArray[11].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[11].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[12] = new chordChoices(11, true, 5); andrew@50: chordChoicesArray[12].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[12].optionArray[1] = new ChordChoice(2, true, false, true, true, true, true); andrew@50: chordChoicesArray[12].optionArray[2] = new ChordChoice(5, false, true, true, true, true, true); andrew@50: chordChoicesArray[12].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[12].optionArray[4] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[13] = new chordChoices(1, false, 2); andrew@50: chordChoicesArray[13].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[13].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[14] = new chordChoices(1, true, 2); andrew@50: chordChoicesArray[14].optionArray[0] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[14].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[15] = new chordChoices(3, false, 12); andrew@50: chordChoicesArray[15].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[3] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[6] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[8] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[9] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[10] = new ChordChoice(11, false, false, true, true, true, true); andrew@50: chordChoicesArray[15].optionArray[11] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[16] = new chordChoices(111, false, 2); andrew@50: chordChoicesArray[16].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[16].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[17] = new chordChoices(6, false, 10); andrew@50: chordChoicesArray[17].optionArray[0] = new ChordChoice(1, false, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[1] = new ChordChoice(1, true, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[5] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[6] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[7] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[8] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: chordChoicesArray[17].optionArray[9] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[18] = new chordChoices(8, false, 17); andrew@50: chordChoicesArray[18].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[3] = new ChordChoice(1, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[4] = new ChordChoice(1, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[6] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[7] = new ChordChoice(4, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[8] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[9] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[10] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[11] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[12] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[13] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[14] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[15] = new ChordChoice(11, false, false, true, true, true, true); andrew@50: chordChoicesArray[18].optionArray[16] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[19] = new chordChoices(8, true, 10); andrew@50: chordChoicesArray[19].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[3] = new ChordChoice(1, false, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[4] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[5] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[6] = new ChordChoice(4, false, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[7] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[19].optionArray[9] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[20] = new chordChoices(3, true, 19); andrew@50: chordChoicesArray[20].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[3] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[4] = new ChordChoice(4, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[5] = new ChordChoice(4, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[6] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[8] = new ChordChoice(6, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[9] = new ChordChoice(6, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[10] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[12] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[13] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[14] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[15] = new ChordChoice(10, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[16] = new ChordChoice(10, true, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[17] = new ChordChoice(11, false, false, true, true, true, true); andrew@50: chordChoicesArray[20].optionArray[18] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[21] = new chordChoices(6, true, 9); andrew@50: chordChoicesArray[21].optionArray[0] = new ChordChoice(1, false, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[1] = new ChordChoice(1, true, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[5] = new ChordChoice(4, false, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[21].optionArray[8] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[22] = new chordChoices(10, false, 13); andrew@50: chordChoicesArray[22].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[7] = new ChordChoice(6, false, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[9] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true); andrew@50: chordChoicesArray[22].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: chordChoicesArray[23] = new chordChoices(10, true, 12); andrew@50: chordChoicesArray[23].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[2] = new ChordChoice(3, false, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[3] = new ChordChoice(3, true, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[5] = new ChordChoice(6, true, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[6] = new ChordChoice(6, false, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[9] = new ChordChoice(9, false, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true); andrew@50: chordChoicesArray[23].optionArray[11] = new ChordChoice(11, true, false, true, true, true, true); andrew@50: andrew@50: andrew@50: } andrew@50: public void loadSequences(){ andrew@50: andrew@50: ArrayList sequenceBass = new ArrayList(); andrew@50: sequenceBass.add(new NoteEvent(15, 2, 1, 1, 1, 1, 0, 3, 3, 0)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 1, 2, 1, 0, 0, 0, 5)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 2, 3, 1, 0, 0, 0, 5)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 2, 4, 1, 0, 0, 0, 5)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 3, 2, 1, 0, 0, 0, 5)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 3, 3, 1, 0, 0, 0, 5)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 4, 1, 1, 0, 0, 0, 5)); andrew@50: // sequenceBass.add(new NoteEvent(15, 2, 1, 4, 2, 1, 0, 0, 0, 5)); andrew@50: seedSequencer(sequenceBass, 2); andrew@50: andrew@50: ArrayList sequencePizz = new ArrayList(); andrew@50: sequencePizz.add(new NoteEvent(13, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(12, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(11, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(10, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(9, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(8, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(7, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(6, 2, 1, 1, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(0, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(1, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(2, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(3, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(4, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(8, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(7, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(6, 2, 1, 2, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(13, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(12, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(11, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(10, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(9, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(8, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(7, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(6, 2, 1, 3, 3, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(0, 2, 1, 4, 1, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(1, 2, 1, 4, 1, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(2, 2, 1, 4, 1, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(3, 2, 1, 4, 1, 1, 0, 0, 1, 0)); andrew@50: sequencePizz.add(new NoteEvent(4, 2, 1, 4, 1, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(8, 2, 1, 4, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(7, 2, 1, 4, 3, 1, 0, 0, 1, 0)); andrew@50: // sequencePizz.add(new NoteEvent(6, 2, 1, 4, 3, 1, 0, 0, 1, 0)); andrew@50: seedSequencer(sequencePizz, 3); andrew@50: /* andrew@50: ArrayList sequenceStrings = new ArrayList(); andrew@50: sequenceStrings.add(new NoteEvent(13, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(12, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(11, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(10, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(9, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(8, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(7, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: sequenceStrings.add(new NoteEvent(6, 2, 1, 1, 1, 1, 0, 1, 3, 0)); andrew@50: seedSequencer(sequenceStrings, 4); andrew@50: */ andrew@50: andrew@50: } andrew@50: andrew@50: public void seedSequencer(ArrayList sIn, int track){ andrew@50: for (int i = 0; i < sIn.size(); i++){ andrew@50: NoteEvent s = sIn.get(i); andrew@50: // println("info stuff : " + s[i].notePitch); andrew@50: 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: 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: } andrew@50: } andrew@50: static public void main(String args[]) { andrew@50: PApplet.main(new String[] { "--bgcolor=#FFFFFF", "HeresyBigBangDone" }); andrew@50: } andrew@50: }