changeset 32:f7caff1c2fa6

i hope to have done osc - by hg -resolve --all and then coming back here to do commit
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 25 Feb 2011 13:48:11 +0000
parents e71aad40a068 (current diff) 1df5ded9f9ff (diff)
children 8ab665941557 9840e732a586
files Ableton Project/osc_input.amxd of/frabk.ttf of/testApp.cpp of/testApp.h
diffstat 20 files changed, 4352 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
Binary file Ableton Project/Ableton.als has changed
Binary file Ableton Project/osc_input.amxd has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Abletons max connection.maxpat	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,1905 @@
+{
+	"patcher" : 	{
+		"fileversion" : 1,
+		"rect" : [ 815.0, 97.0, 584.0, 712.0 ],
+		"bglocked" : 0,
+		"defrect" : [ 815.0, 97.0, 584.0, 712.0 ],
+		"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
+		"openinpresentation" : 0,
+		"default_fontsize" : 12.0,
+		"default_fontface" : 0,
+		"default_fontname" : "Arial",
+		"gridonopen" : 0,
+		"gridsize" : [ 15.0, 15.0 ],
+		"gridsnaponopen" : 0,
+		"toolbarvisible" : 1,
+		"boxanimatetime" : 200,
+		"imprint" : 0,
+		"enablehscroll" : 1,
+		"enablevscroll" : 1,
+		"devicewidth" : 0.0,
+		"boxes" : [ 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "1 1 48",
+					"patching_rect" : [ 678.0, 240.0, 50.0, 18.0 ],
+					"id" : "obj-167",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "button",
+					"patching_rect" : [ 668.0, 157.0, 20.0, 20.0 ],
+					"id" : "obj-165",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "ctlout a",
+					"patching_rect" : [ 325.0, 648.0, 49.0, 20.0 ],
+					"id" : "obj-163",
+					"fontname" : "Arial",
+					"numinlets" : 3,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "map to launch scene",
+					"patching_rect" : [ 992.0, 580.0, 122.0, 20.0 ],
+					"id" : "obj-162",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0,
+					"presentation_rect" : [ 1031.0, 586.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "127 2 16, 0 2 16",
+					"patching_rect" : [ 894.0, 581.0, 97.0, 18.0 ],
+					"id" : "obj-161",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "launch scene and move to next scene. (different scenes are different drum loop)",
+					"linecount" : 7,
+					"patching_rect" : [ 334.0, 529.285706, 67.0, 86.0 ],
+					"id" : "obj-144",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 9.836608
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "127 2 16, 0 2 16",
+					"linecount" : 2,
+					"patching_rect" : [ 325.0, 497.0, 60.0, 32.0 ],
+					"id" : "obj-141",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "IAC Driver Bus should be set to output 'a' under MIDI settings.",
+					"linecount" : 2,
+					"patching_rect" : [ 12.0, 67.37207, 220.0, 39.0 ],
+					"frgb" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"id" : "obj-139",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"bgcolor" : [ 0.811765, 0.372549, 0.372549, 1.0 ],
+					"numoutlets" : 0,
+					"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"fontsize" : 14.012403,
+					"presentation_rect" : [ 15.0, 67.37207, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "to Ableton",
+					"patching_rect" : [ 405.0, 670.0, 67.0, 20.0 ],
+					"id" : "obj-138",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "We listen on port 12346.",
+					"linecount" : 2,
+					"patching_rect" : [ 401.0, 2.37207, 103.0, 39.0 ],
+					"frgb" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"id" : "obj-135",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"bgcolor" : [ 0.811765, 0.372549, 0.372549, 1.0 ],
+					"numoutlets" : 0,
+					"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"fontsize" : 14.012403,
+					"presentation_rect" : [ 997.0, 240.37207, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "CC2",
+					"patching_rect" : [ 686.0, 583.0, 35.0, 20.0 ],
+					"id" : "obj-134",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0,
+					"presentation_rect" : [ 785.0, 566.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "CC1",
+					"patching_rect" : [ 686.0, 556.0, 35.0, 20.0 ],
+					"id" : "obj-133",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Inst 3",
+					"patching_rect" : [ 836.0, 529.0, 43.0, 20.0 ],
+					"id" : "obj-131",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0,
+					"presentation_rect" : [ 935.0, 512.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Inst 2",
+					"patching_rect" : [ 784.0, 529.0, 43.0, 20.0 ],
+					"id" : "obj-130",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0,
+					"presentation_rect" : [ 883.0, 512.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Inst 1",
+					"patching_rect" : [ 730.0, 529.0, 43.0, 20.0 ],
+					"id" : "obj-129",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "50 2 3",
+					"patching_rect" : [ 836.0, 583.0, 44.0, 18.0 ],
+					"id" : "obj-126",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ],
+					"presentation_rect" : [ 934.0, 566.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "50 1 3",
+					"patching_rect" : [ 836.0, 556.0, 44.0, 18.0 ],
+					"id" : "obj-127",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ],
+					"presentation_rect" : [ 934.0, 541.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "50 2 2",
+					"patching_rect" : [ 784.0, 583.0, 44.0, 18.0 ],
+					"id" : "obj-124",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ],
+					"presentation_rect" : [ 881.0, 566.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "50 1 2",
+					"patching_rect" : [ 784.0, 556.0, 44.0, 18.0 ],
+					"id" : "obj-125",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ],
+					"presentation_rect" : [ 881.0, 541.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "50 2 1",
+					"patching_rect" : [ 730.0, 583.0, 44.0, 18.0 ],
+					"id" : "obj-123",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ],
+					"presentation_rect" : [ 829.0, 566.0, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "50 1 1",
+					"patching_rect" : [ 730.0, 556.0, 44.0, 18.0 ],
+					"id" : "obj-122",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "ctlout a",
+					"patching_rect" : [ 784.0, 622.0, 49.0, 20.0 ],
+					"id" : "obj-120",
+					"fontname" : "Arial",
+					"numinlets" : 3,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "For setting up the mapping in Ableton:",
+					"linecount" : 2,
+					"patching_rect" : [ 680.0, 479.191315, 135.0, 40.0 ],
+					"id" : "obj-119",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 14.350855
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Send chord changes 68ms early.",
+					"patching_rect" : [ 197.0, 385.92392, 167.0, 18.0 ],
+					"id" : "obj-115",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 10.29036
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "IP address for Joe needs to be set below",
+					"linecount" : 2,
+					"patching_rect" : [ 12.0, 6.492308, 226.0, 57.0 ],
+					"frgb" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"id" : "obj-113",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"bgcolor" : [ 0.811765, 0.372549, 0.372549, 1.0 ],
+					"numoutlets" : 0,
+					"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"fontsize" : 22.117697
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "to Joe",
+					"patching_rect" : [ 120.0, 520.37207, 50.0, 23.0 ],
+					"frgb" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"id" : "obj-111",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"bgcolor" : [ 0.811765, 0.372549, 0.372549, 1.0 ],
+					"numoutlets" : 0,
+					"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
+					"fontsize" : 14.012403
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "delay 68",
+					"patching_rect" : [ 127.0, 414.0, 56.0, 20.0 ],
+					"id" : "obj-109",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "delay 400",
+					"patching_rect" : [ 127.0, 375.0, 63.0, 20.0 ],
+					"id" : "obj-108",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "final beat",
+					"patching_rect" : [ 146.0, 340.0, 59.0, 20.0 ],
+					"id" : "obj-107",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "button",
+					"patching_rect" : [ 126.0, 340.0, 20.0, 20.0 ],
+					"id" : "obj-105",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "+ 1",
+					"patching_rect" : [ 52.0, 363.756714, 26.5, 17.0 ],
+					"id" : "obj-94",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 9.108685,
+					"outlettype" : [ "int" ],
+					"presentation_rect" : [ 619.0, 546.756714, 0.0, 0.0 ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "+ 1",
+					"patching_rect" : [ 86.0, 362.756714, 26.5, 17.0 ],
+					"id" : "obj-93",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 9.108685,
+					"outlettype" : [ "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "number",
+					"patching_rect" : [ 86.0, 386.0, 17.996094, 20.0 ],
+					"id" : "obj-92",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"triangle" : 0,
+					"outlettype" : [ "int", "bang" ],
+					"ignoreclick" : 1
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "number",
+					"patching_rect" : [ 52.0, 386.0, 31.0, 20.0 ],
+					"id" : "obj-90",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"triangle" : 0,
+					"outlettype" : [ "int", "bang" ],
+					"ignoreclick" : 1
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "% 4",
+					"patching_rect" : [ 86.0, 342.84613, 26.5, 17.0 ],
+					"id" : "obj-88",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 9.108685,
+					"outlettype" : [ "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "/ 4",
+					"patching_rect" : [ 52.0, 342.84613, 26.5, 17.0 ],
+					"id" : "obj-87",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 9.164513,
+					"outlettype" : [ "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "loadmess 16",
+					"patching_rect" : [ 110.0, 242.0, 79.0, 20.0 ],
+					"id" : "obj-86",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "bars per chord & drum loop",
+					"patching_rect" : [ 161.0, 265.0, 158.0, 20.0 ],
+					"id" : "obj-85",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "expr $i1*4 - 1",
+					"patching_rect" : [ 110.0, 289.374817, 70.0, 18.0 ],
+					"id" : "obj-83",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"fontsize" : 10.024733,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "number",
+					"patching_rect" : [ 110.0, 265.0, 50.0, 20.0 ],
+					"id" : "obj-80",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"outlettype" : [ "int", "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "counter 0 63",
+					"patching_rect" : [ 52.0, 312.0, 77.0, 20.0 ],
+					"id" : "obj-78",
+					"fontname" : "Arial",
+					"numinlets" : 5,
+					"numoutlets" : 4,
+					"fontsize" : 12.0,
+					"outlettype" : [ "int", "", "", "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "led",
+					"patching_rect" : [ 78.0, 228.0, 28.0, 28.0 ],
+					"id" : "obj-75",
+					"numinlets" : 1,
+					"blinktime" : 234,
+					"numoutlets" : 1,
+					"outlettype" : [ "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "toggle",
+					"patching_rect" : [ 41.0, 168.0, 20.0, 20.0 ],
+					"id" : "obj-74",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"outlettype" : [ "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "nearly 128 BPM",
+					"patching_rect" : [ 110.0, 205.0, 99.0, 20.0 ],
+					"id" : "obj-72",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "metro 468",
+					"patching_rect" : [ 41.0, 205.0, 65.0, 20.0 ],
+					"id" : "obj-70",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Clock to change drum loop and chord",
+					"linecount" : 2,
+					"patching_rect" : [ 13.0, 125.0, 150.0, 34.0 ],
+					"id" : "obj-69",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Simulate Kinect input",
+					"patching_rect" : [ 981.0, 16.441864, 164.0, 26.0 ],
+					"id" : "obj-67",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 16.599777
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "p delay note-offs for instrument 1",
+					"patching_rect" : [ 401.0, 248.944763, 186.0, 20.0 ],
+					"id" : "obj-65",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ],
+					"patcher" : 					{
+						"fileversion" : 1,
+						"rect" : [ 25.0, 69.0, 640.0, 480.0 ],
+						"bglocked" : 0,
+						"defrect" : [ 25.0, 69.0, 640.0, 480.0 ],
+						"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
+						"openinpresentation" : 0,
+						"default_fontsize" : 12.0,
+						"default_fontface" : 0,
+						"default_fontname" : "Arial",
+						"gridonopen" : 0,
+						"gridsize" : [ 15.0, 15.0 ],
+						"gridsnaponopen" : 0,
+						"toolbarvisible" : 1,
+						"boxanimatetime" : 200,
+						"imprint" : 0,
+						"enablehscroll" : 1,
+						"enablevscroll" : 1,
+						"devicewidth" : 0.0,
+						"boxes" : [ 							{
+								"box" : 								{
+									"maxclass" : "comment",
+									"text" : "pitch vel chan",
+									"patching_rect" : [ 208.0, 461.0, 96.0, 20.0 ],
+									"id" : "obj-5",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"fontsize" : 12.0
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "comment",
+									"text" : "pitch vel chan",
+									"patching_rect" : [ 161.0, 57.0, 86.0, 20.0 ],
+									"id" : "obj-2",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"fontsize" : 12.0
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "zl rev",
+									"patching_rect" : [ 192.0, 414.055237, 39.0, 20.0 ],
+									"id" : "obj-62",
+									"fontname" : "Arial",
+									"numinlets" : 2,
+									"numoutlets" : 2,
+									"fontsize" : 12.0,
+									"outlettype" : [ "", "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "comment",
+									"text" : "chan vel pitch",
+									"patching_rect" : [ 208.0, 389.566895, 73.0, 17.0 ],
+									"id" : "obj-61",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"fontsize" : 9.106835
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "prepend 1",
+									"patching_rect" : [ 192.0, 367.055237, 65.0, 20.0 ],
+									"id" : "obj-59",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 1,
+									"fontsize" : 12.0,
+									"outlettype" : [ "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "pack 0 0",
+									"patching_rect" : [ 192.0, 310.055237, 56.0, 20.0 ],
+									"id" : "obj-58",
+									"fontname" : "Arial",
+									"numinlets" : 2,
+									"numoutlets" : 1,
+									"fontsize" : 12.0,
+									"outlettype" : [ "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "pipe 100",
+									"patching_rect" : [ 50.0, 337.055237, 57.0, 20.0 ],
+									"id" : "obj-57",
+									"fontname" : "Arial",
+									"numinlets" : 2,
+									"numoutlets" : 1,
+									"fontsize" : 12.0,
+									"outlettype" : [ "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "pack 0 0",
+									"patching_rect" : [ 50.0, 310.055237, 56.0, 20.0 ],
+									"id" : "obj-56",
+									"fontname" : "Arial",
+									"numinlets" : 2,
+									"numoutlets" : 1,
+									"fontsize" : 12.0,
+									"outlettype" : [ "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "comment",
+									"text" : "chan vel pitch",
+									"patching_rect" : [ 157.0, 164.629944, 79.0, 19.0 ],
+									"id" : "obj-53",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"fontsize" : 10.536201
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "comment",
+									"text" : "vel pitch",
+									"patching_rect" : [ 148.0, 217.055237, 55.0, 20.0 ],
+									"id" : "obj-51",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"fontsize" : 12.0
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "if $i1!=0 then $i1 else out2 0",
+									"patching_rect" : [ 50.0, 277.055237, 161.0, 20.0 ],
+									"id" : "obj-24",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 2,
+									"fontsize" : 12.0,
+									"outlettype" : [ "", "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "unpack 0 0",
+									"patching_rect" : [ 131.0, 238.055237, 69.0, 20.0 ],
+									"id" : "obj-22",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 2,
+									"fontsize" : 12.0,
+									"outlettype" : [ "int", "int" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "comment",
+									"text" : "Instrument 1 is monophonic with glide: this bit of patching delays the note-offs slightly",
+									"linecount" : 3,
+									"patching_rect" : [ 155.0, 100.0, 147.0, 42.0 ],
+									"id" : "obj-20",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"fontsize" : 10.385214
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "zl rev",
+									"patching_rect" : [ 131.0, 145.055237, 39.0, 20.0 ],
+									"id" : "obj-12",
+									"fontname" : "Arial",
+									"numinlets" : 2,
+									"numoutlets" : 2,
+									"fontsize" : 12.0,
+									"outlettype" : [ "", "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "newobj",
+									"text" : "route 1",
+									"patching_rect" : [ 131.0, 185.055237, 48.0, 20.0 ],
+									"id" : "obj-4",
+									"fontname" : "Arial",
+									"numinlets" : 1,
+									"numoutlets" : 2,
+									"fontsize" : 12.0,
+									"outlettype" : [ "", "" ]
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "inlet",
+									"patching_rect" : [ 131.0, 40.0, 25.0, 25.0 ],
+									"id" : "obj-63",
+									"numinlets" : 0,
+									"numoutlets" : 1,
+									"outlettype" : [ "" ],
+									"comment" : ""
+								}
+
+							}
+, 							{
+								"box" : 								{
+									"maxclass" : "outlet",
+									"patching_rect" : [ 192.0, 494.055237, 25.0, 25.0 ],
+									"id" : "obj-64",
+									"numinlets" : 1,
+									"numoutlets" : 0,
+									"comment" : ""
+								}
+
+							}
+ ],
+						"lines" : [ 							{
+								"patchline" : 								{
+									"source" : [ "obj-12", 0 ],
+									"destination" : [ "obj-4", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-4", 0 ],
+									"destination" : [ "obj-22", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-22", 0 ],
+									"destination" : [ "obj-24", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-22", 1 ],
+									"destination" : [ "obj-56", 1 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-24", 0 ],
+									"destination" : [ "obj-56", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-56", 0 ],
+									"destination" : [ "obj-57", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-24", 1 ],
+									"destination" : [ "obj-58", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-22", 1 ],
+									"destination" : [ "obj-58", 1 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-57", 0 ],
+									"destination" : [ "obj-59", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-58", 0 ],
+									"destination" : [ "obj-59", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-4", 1 ],
+									"destination" : [ "obj-62", 1 ],
+									"hidden" : 0,
+									"midpoints" : [ 169.5, 212.055237, 301.0, 212.055237, 301.0, 409.055237, 221.5, 409.055237 ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-59", 0 ],
+									"destination" : [ "obj-62", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-63", 0 ],
+									"destination" : [ "obj-12", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+, 							{
+								"patchline" : 								{
+									"source" : [ "obj-62", 0 ],
+									"destination" : [ "obj-64", 0 ],
+									"hidden" : 0,
+									"midpoints" : [  ]
+								}
+
+							}
+ ]
+					}
+,
+					"saved_object_attributes" : 					{
+						"default_fontsize" : 12.0,
+						"fontname" : "Arial",
+						"globalpatchername" : "",
+						"fontface" : 0,
+						"default_fontface" : 0,
+						"fontsize" : 12.0,
+						"default_fontname" : "Arial"
+					}
+
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "udpsend localhost 12344",
+					"patching_rect" : [ 998.0, 214.0, 144.0, 20.0 ],
+					"id" : "obj-32",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "prepend /person",
+					"patching_rect" : [ 998.0, 174.0, 98.0, 20.0 ],
+					"id" : "obj-31",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "pak i f f f",
+					"patching_rect" : [ 998.0, 95.0, 59.5, 20.0 ],
+					"id" : "obj-30",
+					"fontname" : "Arial",
+					"numinlets" : 4,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "flonum",
+					"patching_rect" : [ 1084.0, 50.0, 80.0, 20.0 ],
+					"id" : "obj-29",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"outlettype" : [ "float", "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "flonum",
+					"patching_rect" : [ 1030.0, 50.0, 50.0, 20.0 ],
+					"id" : "obj-27",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"outlettype" : [ "float", "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "flonum",
+					"patching_rect" : [ 977.0, 50.0, 50.0, 20.0 ],
+					"id" : "obj-25",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"outlettype" : [ "float", "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "number",
+					"patching_rect" : [ 923.0, 50.0, 50.0, 20.0 ],
+					"id" : "obj-23",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"outlettype" : [ "int", "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "button",
+					"patching_rect" : [ 414.0, 466.0, 20.0, 20.0 ],
+					"id" : "obj-21",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "button",
+					"patching_rect" : [ 325.0, 436.0, 20.0, 20.0 ],
+					"id" : "obj-19",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"outlettype" : [ "bang" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "flush",
+					"patching_rect" : [ 401.0, 497.0, 49.0, 20.0 ],
+					"id" : "obj-17",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 2,
+					"fontsize" : 12.0,
+					"outlettype" : [ "int", "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "/chord",
+					"patching_rect" : [ 72.0, 522.0, 44.0, 18.0 ],
+					"id" : "obj-16",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "udpsend localhost 12345",
+					"patching_rect" : [ 72.0, 546.0, 144.0, 20.0 ],
+					"id" : "obj-10",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "unpack 0 0 0",
+					"patching_rect" : [ 401.0, 413.0, 79.0, 20.0 ],
+					"id" : "obj-7",
+					"fontname" : "Arial",
+					"numinlets" : 1,
+					"numoutlets" : 3,
+					"fontsize" : 12.0,
+					"outlettype" : [ "int", "int", "int" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "message",
+					"text" : "82 127 2",
+					"linecount" : 2,
+					"patching_rect" : [ 345.0, 243.0, 50.0, 32.0 ],
+					"id" : "obj-6",
+					"fontname" : "Arial",
+					"numinlets" : 2,
+					"numoutlets" : 1,
+					"fontsize" : 12.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "ctlout a",
+					"patching_rect" : [ 694.0, 193.387756, 52.0, 21.0 ],
+					"id" : "obj-2",
+					"fontname" : "Arial",
+					"numinlets" : 3,
+					"numoutlets" : 0,
+					"fontsize" : 12.88093
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "OSC input is routed to instruments 1-3.",
+					"linecount" : 2,
+					"patching_rect" : [ 528.0, 31.91593, 176.0, 45.0 ],
+					"id" : "obj-54",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 16.935125
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "value, CC number, channel",
+					"patching_rect" : [ 738.0, 159.794876, 120.0, 16.0 ],
+					"id" : "obj-43",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 8.46547
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "zl rev",
+					"patching_rect" : [ 694.0, 156.25, 39.0, 19.0 ],
+					"id" : "obj-39",
+					"fontname" : "Arial Bold",
+					"numinlets" : 2,
+					"numoutlets" : 2,
+					"fontsize" : 11.134259,
+					"outlettype" : [ "", "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "Route MIDI data from Joe to the three instruments.",
+					"linecount" : 5,
+					"patching_rect" : [ 327.0, 107.0, 71.0, 64.0 ],
+					"id" : "obj-35",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 10.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "fromsymbol",
+					"patching_rect" : [ 401.0, 218.0, 68.0, 18.0 ],
+					"id" : "obj-15",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"fontsize" : 10.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "print unhandled_osc",
+					"patching_rect" : [ 495.0, 157.0, 109.0, 18.0 ],
+					"id" : "obj-14",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 10.0
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "From tim's Grid mapping.\nIn form: channel, CC number, value",
+					"linecount" : 2,
+					"patching_rect" : [ 702.0, 100.703423, 155.0, 27.0 ],
+					"id" : "obj-13",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 8.716659
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "comment",
+					"text" : "From Joe as one big string",
+					"patching_rect" : [ 417.0, 116.231461, 105.0, 15.0 ],
+					"id" : "obj-11",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 0,
+					"fontsize" : 7.352522
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "route /cc",
+					"patching_rect" : [ 694.0, 132.480774, 55.0, 19.0 ],
+					"id" : "obj-8",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 10.605745,
+					"outlettype" : [ "", "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "route /pitch_vel_chan",
+					"patching_rect" : [ 401.0, 133.0, 113.0, 18.0 ],
+					"id" : "obj-5",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 2,
+					"fontsize" : 10.0,
+					"outlettype" : [ "", "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "udpreceive 12346",
+					"patching_rect" : [ 399.0, 42.0, 94.0, 18.0 ],
+					"id" : "obj-3",
+					"fontname" : "Arial Bold",
+					"numinlets" : 1,
+					"numoutlets" : 1,
+					"fontsize" : 10.0,
+					"outlettype" : [ "" ]
+				}
+
+			}
+, 			{
+				"box" : 				{
+					"maxclass" : "newobj",
+					"text" : "noteout a",
+					"patching_rect" : [ 401.0, 648.0, 79.0, 20.0 ],
+					"id" : "obj-1",
+					"fontname" : "Arial",
+					"numinlets" : 3,
+					"numoutlets" : 0,
+					"fontsize" : 12.0
+				}
+
+			}
+ ],
+		"lines" : [ 			{
+				"patchline" : 				{
+					"source" : [ "obj-8", 0 ],
+					"destination" : [ "obj-167", 1 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-8", 0 ],
+					"destination" : [ "obj-165", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-141", 0 ],
+					"destination" : [ "obj-163", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-19", 0 ],
+					"destination" : [ "obj-141", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-161", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-127", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-126", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-125", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-124", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-122", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-123", 0 ],
+					"destination" : [ "obj-120", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-108", 0 ],
+					"destination" : [ "obj-19", 0 ],
+					"hidden" : 0,
+					"midpoints" : [ 136.5, 402.0, 334.5, 402.0 ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-16", 0 ],
+					"destination" : [ "obj-10", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-105", 0 ],
+					"destination" : [ "obj-108", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-108", 0 ],
+					"destination" : [ "obj-109", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-70", 0 ],
+					"destination" : [ "obj-75", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-74", 0 ],
+					"destination" : [ "obj-70", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-70", 0 ],
+					"destination" : [ "obj-78", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-78", 3 ],
+					"destination" : [ "obj-105", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-80", 0 ],
+					"destination" : [ "obj-83", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-83", 0 ],
+					"destination" : [ "obj-78", 4 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-78", 0 ],
+					"destination" : [ "obj-87", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-78", 0 ],
+					"destination" : [ "obj-88", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-94", 0 ],
+					"destination" : [ "obj-90", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-87", 0 ],
+					"destination" : [ "obj-94", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-93", 0 ],
+					"destination" : [ "obj-92", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-88", 0 ],
+					"destination" : [ "obj-93", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-86", 0 ],
+					"destination" : [ "obj-80", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-15", 0 ],
+					"destination" : [ "obj-65", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-65", 0 ],
+					"destination" : [ "obj-7", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-5", 1 ],
+					"destination" : [ "obj-14", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-5", 0 ],
+					"destination" : [ "obj-15", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-3", 0 ],
+					"destination" : [ "obj-5", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-3", 0 ],
+					"destination" : [ "obj-8", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-8", 0 ],
+					"destination" : [ "obj-39", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-39", 0 ],
+					"destination" : [ "obj-2", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-15", 0 ],
+					"destination" : [ "obj-6", 1 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-7", 2 ],
+					"destination" : [ "obj-1", 2 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-7", 1 ],
+					"destination" : [ "obj-17", 1 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-7", 0 ],
+					"destination" : [ "obj-17", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-17", 0 ],
+					"destination" : [ "obj-1", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-19", 0 ],
+					"destination" : [ "obj-16", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-19", 0 ],
+					"destination" : [ "obj-17", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-17", 1 ],
+					"destination" : [ "obj-1", 1 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-21", 0 ],
+					"destination" : [ "obj-17", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-31", 0 ],
+					"destination" : [ "obj-32", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-30", 0 ],
+					"destination" : [ "obj-31", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-23", 0 ],
+					"destination" : [ "obj-30", 0 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-25", 0 ],
+					"destination" : [ "obj-30", 1 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-27", 0 ],
+					"destination" : [ "obj-30", 2 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+, 			{
+				"patchline" : 				{
+					"source" : [ "obj-29", 0 ],
+					"destination" : [ "obj-30", 3 ],
+					"hidden" : 0,
+					"midpoints" : [  ]
+				}
+
+			}
+ ]
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/DrawingStuff.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,221 @@
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void drawNotes(){ // places the note display grid into the apropriate screen positions
+        int loopsOnScreen = ((width-playArea) / tracks[trSelected].loopLength) + 1;
+        if (loopsOnScreen > currentPulse / tracks[trSelected].loopLength)
+            loopsOnScreen = currentPulse / tracks[trSelected].loopLength;
+        for (int i = 0; i <= loopsOnScreen; i++)
+          image (imgNotes, (width-playArea-(i*tracks[trSelected].loopLength))-currentPulse%(tracks[trSelected].loopLength),0); 
+    }
+
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void pulseFrame(int frameNo){ // Draws a pulsing line at left hand side of the input area when loop restarts
+    strokeWeight(3);
+    if (currentPulse % (tracks[trSelected].loopLength) == 0 || (currentPulse-1) % (tracks[trSelected].loopLength) == 0 || (currentPulse-2) % (tracks[trSelected].loopLength) == 0)
+        stroke(255,255,255);
+    else
+        stroke(255,111,111);
+    line (width-playArea+3, 1, width-playArea+3, 300);  
+} 
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+      
+void drawTempImageGrid(){ // draws the note display image grid
+    imgNotes.stroke(209,137,255);
+    imgNotes.strokeWeight(15); 
+    for(int i = 0; i < 16; i++){
+       if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){
+            imgNotes.beginDraw();
+            imgNotes.line (currentPulse%(tracks[trSelected].loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(tracks[trSelected].loopLength)+1, i*imageHeight/16+imageHeight/32);
+            imgNotes.endDraw(); 
+            displayNoteOnArray[i] = true;
+        }
+        if (tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity == 0){
+            displayNoteOnArray[i] = false;
+        }
+    
+        if(trSelected ==0){
+            if ((chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){
+                imgNotes.beginDraw();
+                imgNotes.line (currentPulse%(chordsTemp.loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(chordsTemp.loopLength)+1, i*imageHeight/16+imageHeight/32);
+                imgNotes.endDraw(); 
+                displayNoteOnArray[i] = true;
+            }
+            if (chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0){
+                displayNoteOnArray[i] = false;
+            }
+        }
+    }
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void drawLines(){ // draws beat lines
+     int linePosition = 1;
+     int i = 0;
+     for (; linePosition <= imageWidth;){
+         linePosition = i * grid;
+         img.beginDraw();
+         img.stroke(lineColour);
+         img.strokeWeight(2);
+         img.line (linePosition, 0, linePosition, imageHeight);
+         img.endDraw();
+         i++;
+     }
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void drawBarLines(){ // draws bar lines
+     int linePosition = 1;    
+     for (int i = 0; linePosition <= imageWidth;){
+         linePosition = i * grid * beatsPerBar;
+         img.beginDraw();
+         img.stroke(barLineColour);
+         img.strokeWeight(2);
+         img.line (linePosition, 0, linePosition, imageHeight);
+         img.endDraw();
+         i++;
+     }
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void backgroundColour(){ // sets background colour
+     img.beginDraw();
+     img.background (backGround);
+     img.endDraw();
+}
+
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void createNoteFan(){ // creates the input fan
+    if (rpulseup)
+        rpulse++;
+    else rpulse--;
+    if (rpulse == grid)
+        rpulseup = false;
+    if (rpulse < 1)
+        rpulseup = true;
+    imgNoteFan.beginDraw();
+    imgNoteFan.stroke(rpulse/grid*255,50,50);
+    imgNoteFan.strokeWeight(1);
+    for (int i = 0; i < 16; i++){
+        if (!chordSelecter)
+            if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){
+                imgNoteFan.fill(209,137,255);
+            }
+            else
+                imgNoteFan.fill(0,0,0);
+         else
+            if (i == 14 || i == 12 || i == 9 || i == 7 || i == 5 || i == 3 || i == 2 || i == 1 || i == 0)
+                imgNoteFan.fill(0,0,0);
+         else
+                imgNoteFan.fill(255,255,255);    
+      imgNoteFan.quad(0, i*(imageHeight/16.0), 0, (i+1)*(imageHeight/16.0), fanWidth, (imageHeight/2.0), fanWidth, (imageHeight/2.0));
+    }
+
+    imgNoteFan.endDraw();
+    
+}
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void calcColours(){ // sets up colour values for background, bar and beat lines
+
+    if(heresyChordChanged){
+
+        if(currentChord == 0){
+            redC = 0;
+            greenC = 0;
+            blueC = 0;
+        }
+        
+        if(currentChord == 1){
+            redC = 90;
+            greenC = 76;
+            blueC = 3;
+        }
+        
+        if(currentChord == 2){
+            redC = 254;
+            greenC = 255;
+            blueC = 18;
+        }
+        
+         if(currentChord == 3){
+            redC = 0;
+            greenC = 0;
+            blueC = 0;
+        }
+        
+        if(currentChord == 4){
+            redC = 136;
+            greenC = 245;
+            blueC = 49;
+        }
+        
+        if(currentChord == 5){
+            redC = 9;
+            greenC = 18;
+            blueC = 232;
+        }
+        
+        if(currentChord == 6){
+            redC = 99;
+            greenC = 99;
+            blueC = 100;
+        }
+        
+        if(currentChord == 7){
+            redC = 255;
+            greenC = 166;
+            blueC = 21;
+        }
+        
+        if(currentChord == 8){
+            redC = 13;
+            greenC = 79;
+            blueC = 147;
+        }
+        
+        if(currentChord == 9){
+            redC = 255;
+            greenC = 165;
+            blueC = 165;
+        }
+        
+        if(currentChord == 10){
+            redC = 89;
+            greenC = 110;
+            blueC = 134;
+        }
+        
+        if(currentChord == 11){
+            redC = 68;
+            greenC = 242;
+            blueC = 250;
+        }
+
+        backGround = color(redC, greenC, blueC);
+        lineColour = color((redC + 100) % 255,(greenC + 69) % 255,(blueC + 214) % 255);
+        barLineColour = color((redC + 205) % 255, (greenC + 174) % 255, (blueC + 159) % 255);
+        
+        backgroundColour();
+        drawLines();
+        drawBarLines();
+    }
+}
+        
+        
+      
+     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/Header.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,64 @@
+import oscP5.*; 
+import netP5.*; 
+import maxlink.*;
+
+OscP5 oscP5return;
+NetAddress ableton = new NetAddress("169.254.107.152", 12346); // OSC to ableton
+MaxLink link = new MaxLink(this, "midiCom");
+import processing.opengl.*;
+int imageWidth = 1000;
+int imageHeight = 300;
+int fanWidth = 400;
+
+float rpulse;
+boolean rpulseup;
+boolean clickTrack;
+int currentPulse = 0;
+int grid = 32;
+int fractions = 4;
+int pulseFrequency = grid / fractions;
+int beatsPerBar = 4;
+int bar = 0, beat = 0, fraction = 0, pulse = 0;
+int pulsesPerBar = beatsPerBar * grid;
+
+color lineColour = color(150,150,150);
+color barLineColour = color(255,255,95);
+color backGround = color(50,81,191);
+int redC = 50;
+int greenC = 81;
+int blueC = 191;
+PImage screenImage;
+PGraphics img, imgNotes, imgNoteFan;
+PImage test;
+
+int barOfPixels = grid * beatsPerBar;
+int playArea = 200;
+int x= 0;
+int x2= 0;
+PFont arial;
+int arraySize = 800-playArea;
+int bpm = 130;
+int tempo = bpm/60*grid;
+int noOfBars = 2;
+int loopLength = grid*beatsPerBar*noOfBars;
+Track[] tracks = new Track[16];
+Track chordsTemp;
+int trSelected;
+boolean[] noteOnArray = new boolean[16];
+boolean[] displayNoteOnArray = new boolean[16];
+int[] noteOnArrayLength = new int[16];
+boolean chordSelecter, clickTrackOn;
+int lastTrack;
+int trackStorer, screenAni;
+boolean quantizeValueIn, loopLengthValueIn, haveQuestion, aniOut, muteValueIn;
+String screenQuestion;
+boolean eraseOn;
+
+int crneeded = 24;
+int noOfChords;
+boolean tonicNeeded;
+boolean chordAI = true;
+int lastChordChange;
+boolean lastMinor; 
+int barCounter;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/HeresyAl.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,574 @@
+boolean heresyMinor, oldHeresyMinor, heresy7th, oldHeresy7th, heresy9th, oldHeresy9th, heresy11th, oldHeresy11th, heresy13th, oldHeresy13th, heresyDom; 
+boolean heresyMinorChanged, heresyChordChanged, heresy7thChanged, heresy9thChanged, heresy11thChanged, heresy13thChanged, heresyChange, dontRevoice;
+int currentChord, lastChord;
+VPArray[] VPA = new VPArray[16];
+int[] notesOnArray = new int[16];
+int no1s = 0; int no3s = 0; int no5s = 0; int no7s = 0; int no9s = 0; int no11s = 0; int no13s = 0;
+int tonic = 0;
+
+
+
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+  /*  public int getHeresyPitch(int extension, int notePosition){  // delivers heresy pitches
+        int value = getExtentionPitch(extension) % 12;
+        if (notePosition == 15) value += 24;
+        if (notePosition == 14) value += 36;
+        if (notePosition == 13) value += 36;
+        if (notePosition == 12) value += 48;
+        if (notePosition == 11) value += 48;        
+        if (notePosition == 10) value += 48;     
+        if (notePosition == 9) value += 48;
+        if (notePosition == 8) value += 60;
+        if (notePosition == 7) value += 60;
+        if (notePosition == 6) value += 60;
+        if (notePosition == 5) value += 60;        
+        if (notePosition == 4) value += 72;  
+        if (notePosition == 3) value += 72;
+        if (notePosition == 2) value += 72;
+        if (notePosition == 1) value += 72;
+        if (notePosition == 0) value += 84;
+        return value;
+    }*/
+    
+ 
+    public int heresyPitchInfo(int arrayPosition){ // returns a value for checking if note required is currently playing
+        int value = 0;
+        if (heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){
+            if (arrayPosition == 15) value = (15-currentChord) + 24;
+            if (arrayPosition == 14) value = (15-currentChord) + 36;
+            if (arrayPosition == 13) value = (15-currentChord) + 43;
+            if (arrayPosition == 12) value = (15-currentChord) + 50;
+            if (arrayPosition == 11) value = (15-currentChord) + 51;
+            if (arrayPosition == 10) value = (15-currentChord) + 58; 
+            if (arrayPosition == 9) value = (15-currentChord) + 65;
+            if (arrayPosition == 8) value = (15-currentChord) + 67;
+            if (arrayPosition == 7) value = (15-currentChord) + 70;
+            if (arrayPosition == 6) value = (15-currentChord) + 72;
+            if (arrayPosition == 5) value = (15-currentChord) + 74;
+            if (arrayPosition == 4) value = (15-currentChord) + 75;
+            if (arrayPosition == 3) value = (15-currentChord) + 77;
+            if (arrayPosition == 2) value = (15-currentChord) + 79;
+            if (arrayPosition == 1) value = (15-currentChord) + 82;
+            if (arrayPosition == 0) value = (15-currentChord) + 84;
+        }
+        if (!heresyMinor && heresy7th && heresy9th && heresy11th && !heresy13th){
+            if (arrayPosition == 15) value = (15-currentChord) + 24;
+            if (arrayPosition == 14) value = (15-currentChord) + 36;
+            if (arrayPosition == 13) value = (15-currentChord) + 43;
+            if (arrayPosition == 12) value = (15-currentChord) + 50;
+            if (arrayPosition == 11) value = (15-currentChord) + 52;
+            if (arrayPosition == 10) value = (15-currentChord) + 59; 
+            if (arrayPosition == 9) value = (15-currentChord) + 66;
+            if (arrayPosition == 8) value = (15-currentChord) + 71;
+            if (arrayPosition == 7) value = (15-currentChord) + 74;
+            if (arrayPosition == 6) value = (15-currentChord) + 78;
+            if (arrayPosition == 5) value = (15-currentChord) + 83;
+            if (arrayPosition == 4) value = (15-currentChord) + 75;
+            if (arrayPosition == 3) value = (15-currentChord) + 77;
+            if (arrayPosition == 2) value = (15-currentChord) + 79;
+            if (arrayPosition == 1) value = (15-currentChord) + 82;
+            if (arrayPosition == 0) value = (15-currentChord) + 84;
+        }
+    return value;
+    }
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+    public void playTrackEvents(){ // initiates the playing Heresy AI logic
+      
+        workOutExtensions();
+        //workOutChord();
+        heresyChangeHistory();
+        VpaNoteStater();
+   //   heresyVoicingArray();
+        countNoteOns();
+
+        
+     }
+
+
+ //-------------------------------------------------------------------------------------------------------------------------------
+     
+    public void sendNoteEvents(){  // sends sequencer evernts to the IO section for out put to max
+        for(int i = 1; i < Track.currentNumberOfTracks; i++){
+            if (tracks[i] != null ){
+                for (int ii = 0; ii < 16; ii++) {
+                   if (!VPA[i].VPArrayNotes[ii].played){
+                       outputToMax (VPA[i].VPArrayNotes[ii].VPNotePitch, VPA[i].VPArrayNotes[ii].VPNoteVelocity, i);
+                       VPA[i].VPArrayNotes[ii].played = true;
+                   }
+               }
+            }
+        }
+    }
+    
+
+//-------------------------------------------------------------------------------------------------------------------------------
+     
+    public void VpaNoteStater(){  // calculates pitches based on Heresy AI voice leading and voicing tables.
+      for(int i = 1; i < Track.currentNumberOfTracks; i++){
+            if (tracks[i] != null){
+                for (int ii = 0; ii < 16; ii++) {
+                    if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)] != null){
+                        if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity != 0){
+                            if (VPA[i].VPArrayNotes[ii].VPNoteOn && heresyPitchInfo(ii) != VPA[i].VPArrayNotes[ii].VPNotePitch){
+                           //   println("in...");
+                                VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0;
+                                sendNote(VPA[i].VPArrayNotes[ii], i);
+                                if (i != 1 && i != 5)
+                                    VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3);
+                                else
+                                    VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1);
+                                VPA[i].VPArrayNotes[ii].VPNoteVelocity = 80;
+                                sendNote(VPA[i].VPArrayNotes[ii], i);
+                            }else{
+                           //      println("in2...");
+                                if (i != 1 && i != 5)
+                                    VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 3);
+                                else
+                                    VPA[i].VPArrayNotes[ii].VPNotePitch = heresyPitch(ii, 1);
+                                VPA[i].VPArrayNotes[ii].VPNoteVelocity = 80;
+                                sendNote(VPA[i].VPArrayNotes[ii], i);
+                            }
+                        }
+                        if (tracks[i].sequence[ii][currentPulse%(tracks[i].loopLength)].noteVelocity == 0){
+                            VPA[i].VPArrayNotes[ii].VPNoteVelocity = 0;
+                            sendNote(VPA[i].VPArrayNotes[ii], i);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+/*    public void heresyVoicingArray(){  // sets the voicing array to be used for note ons
+        if (!heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice135;
+        if (heresy7th && !heresy9th && !heresy11th && !heresy13th) hvArray = hchoice7;
+        if (!heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice9;
+        if (!heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice11;
+        if (!heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice13;
+        if (heresy7th && heresy9th && !heresy11th && !heresy13th) hvArray = hchoice79;
+        if (heresy7th && !heresy9th && heresy11th && !heresy13th) hvArray = hchoice711;
+        if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice713;
+        if (!heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice911;
+        if (!heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice913;
+        if (!heresy7th && !heresy9th && heresy11th && heresy13th) hvArray = hchoice1113;
+        if (heresy7th && heresy9th && heresy11th && !heresy13th) hvArray = hchoice7911;
+        if (heresy7th && heresy9th && !heresy11th && heresy13th) hvArray = hchoice7913;
+        if (heresy7th && !heresy9th && !heresy11th && heresy13th) hvArray = hchoice71113;
+        if (!heresy7th && heresy9th && heresy11th && heresy13th) hvArray = hchoice91113;
+    }
+    
+    */
+    
+    
+//------------------------------------------------------------------------------------------------------------------------------- 
+ 
+    public void countNoteOns(){    // counts the note ons for all tracks
+        for (int ii = 0; ii < 16; ii++){
+            notesOnArray[ii] = 0;}
+        for(int i = 1; i < Track.currentNumberOfTracks; i++){
+            for (int ii = 0; ii < 16; ii++){
+                if (VPA[i].VPArrayNotes[ii].VPNoteOn == true)
+                notesOnArray[i]++;
+            }
+        }
+    }
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+ /*   public void calculateHeresyNoteExtensions(){
+        for(int tracki = 1; tracki < Track.currentNumberOfTracks; tracki++){
+            no1s = 0; no3s = 0; no5s = 0; no7s = 0; no9s = 0; no11s = 0; no13s = 0;
+            
+            checkIfNotesAlreadyFit(tracki);
+            
+            calcRemainingNotes(tracki);
+            
+            for (int t = 0; t < 16; t++){
+                VPA[tracki].VPArrayNotes[t].done = false;
+            }
+         }
+     }
+     
+     */
+    
+    
+//-------------------------------------------------------------------------------------------------------------------------------
+
+/*    public void calcRemainingNotes(int tracki){
+        int counter = -1;
+        int looped = 0;
+        while (no1s + no3s + no5s + no7s + no9s + no11s + no13s != 0){
+            counter++;
+            if (counter >= notesOnArray[tracki]){
+                counter = 0;
+                looped++;
+            }
+            int nextExtension = hvArray[counter];
+            if(extensionNeeded(nextExtension)){
+                for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){
+                    if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){
+                        if (extensionPossible(playingNotesi, nextExtension)){
+                            VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = getHeresyPitch(nextExtension, playingNotesi);
+                            VPA[tracki].VPArrayNotes[playingNotesi].done = true;
+                            println("got pitch " + VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch); 
+                      //    correctIfNeeded(tracki, playingNotesi, nextExtension); 
+                        }else println("wasn't possible");
+                    }
+                }
+            }
+            if (looped > 3) {
+                for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){
+                    if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn == true && !VPA[tracki].VPArrayNotes[playingNotesi].done){
+                        VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn = false;
+                        VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -1;
+                    }
+                }
+                System.out.println("Had to break_________________");
+                break;
+            }
+        }
+    }
+    
+    */
+    
+    
+//-------------------------------------------------------------------------------------------------------------------------------    
+  
+ /*   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
+        boolean alreadyGotNote = false; boolean alreadyGotNotePlus12 = false; boolean alreadyGotNoteMinus12 = false; 
+        int pitchAverage = 0;
+        for (int i = 0; i < 16; i++)
+            if (i != playingNotesi){
+                if (VPA[tracki].VPArrayNotes[i].done)
+                    pitchAverage += VPA[tracki].VPArrayNotes[i].VPNotePitch;
+                if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch) 
+                    alreadyGotNote = true;
+                if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12) 
+                    alreadyGotNotePlus12 = true;
+                if (VPA[tracki].VPArrayNotes[i].VPNotePitch == VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12) 
+                    alreadyGotNoteMinus12 = true;  
+            }
+            if (notesOnArray[tracki]-1 > 0)
+                pitchAverage = pitchAverage / (notesOnArray[tracki]-1);
+            else 
+                pitchAverage = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch;
+            boolean correctedIt = false;
+            if (alreadyGotNote){
+                println("correcting note..........");
+                if (!alreadyGotNotePlus12 && pitchAverage > VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){
+                    VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12;
+                    correctedIt = true;
+                }else
+                    if (!alreadyGotNoteMinus12){
+                        VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12;
+                        correctedIt = true;
+                    }
+                if (!alreadyGotNoteMinus12 && pitchAverage < VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch){
+                    VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch - 12;
+                    correctedIt = true;
+                }else
+                    if (!alreadyGotNotePlus12){
+                        VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch + 12;
+                        correctedIt = true;
+                    }
+               }
+               if (alreadyGotNote && !correctedIt)
+                   VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch = -2;
+               if (!alreadyGotNote || correctedIt){
+                   VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80;
+                   VPA[tracki].VPArrayNotes[playingNotesi].done = true;
+                   VPA[tracki].VPArrayNotes[playingNotesi].played = false;
+                   extensionCounter(false, nextExtension);    
+               }else{
+                   VPA[tracki].VPArrayNotes[playingNotesi].VPNoteVelocity = 80;
+                   VPA[tracki].VPArrayNotes[playingNotesi].done = true;
+               }
+    }
+    
+    */
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+
+
+ /*   public void checkIfNotesAlreadyFit(int tracki){
+        for (int extensioni = 0; extensioni < notesOnArray[tracki]; extensioni++){
+            boolean extensionFound = false;
+            for (int playingNotesi = 0; playingNotesi < 16; playingNotesi++){
+                if (VPA[tracki].VPArrayNotes[playingNotesi].VPNoteOn && !VPA[tracki].VPArrayNotes[playingNotesi].done && !extensionFound && VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch >= 24){
+                    if (disiredPitch(VPA[tracki].VPArrayNotes[playingNotesi].VPNotePitch, hvArray[extensioni])){
+                        VPA[tracki].VPArrayNotes[playingNotesi].done = true;
+                        extensionFound = true;
+                    }
+                }
+            }
+            if (!extensionFound){
+                extensionCounter(true, hvArray[extensioni]);
+            }
+        }
+    }
+    
+*/
+            
+            
+//-------------------------------------------------------------------------------------------------------------------------------             
+
+ /*   public boolean pitchInChord(int currentPitch){
+        boolean returnValue = false;
+        for (int i = 0; i < 16; i++){
+          //  println("currentPitch " + currentPitch + " getHeresyPitch(hvArray[i], 5) % 12) " + (getHeresyPitch(hvArray[i], 5)));
+            if (currentPitch % 12 == (getHeresyPitch(hvArray[i], 5) % 12));
+                returnValue = true;
+        }
+        return returnValue;
+    }
+ */       
+    
+//-------------------------------------------------------------------------------------------------------------------------------           
+
+ /*    public boolean extensionNeeded(int extension){
+     boolean needed = false;
+         if (extension == 1 && no1s > 0) needed = true;
+         if (extension == 3 && no3s > 0) needed = true;
+         if (extension == 5 && no5s > 0) needed = true;
+         if (extension == 7 && no7s > 0) needed = true;
+         if (extension == 9 && no9s > 0) needed = true;
+         if (extension == 11 && no11s > 0) needed = true;
+         if (extension == 13 && no13s > 0) needed = true;
+         return needed;
+     }
+   */
+    
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+  /*  public int extensionMatch(){
+        int returnValue = -1;
+        for (int i = 0; i < 16; i++){
+            if( hvArray[i] == 1 && no1s > 0){
+                returnValue =  hvArray[i];
+                break;
+            }
+            if( hvArray[i] == 3 && no3s > 0){
+                returnValue =  hvArray[i];
+                break;
+            }
+            if( hvArray[i] == 5 && no5s > 0){
+                returnValue = hvArray[i];
+                break;
+            }
+            if( hvArray[i] == 7 && no7s > 0){
+                returnValue = hvArray[i];
+                break;
+            }
+            if( hvArray[i] == 9 && no9s > 0){
+                returnValue = hvArray[i];
+                break;
+            }
+            if( hvArray[i] == 11 && no11s > 0){
+                returnValue = hvArray[i];
+                break;
+            }
+            if( hvArray[i] == 13 && no13s > 0){
+                returnValue = hvArray[i];
+                break;
+            }
+        }
+        return returnValue;
+    }
+    
+    */
+      
+
+    
+    
+//-------------------------------------------------------------------------------------------------------------------------------   
+
+/*    public boolean extensionPossible(int playingNotesi, int extentionNeeded){
+        Boolean returnValue = true;
+        if (extentionNeeded != 1 && playingNotesi < 2) returnValue =  false;
+        if ((extentionNeeded == 5 || extentionNeeded == 7 || extentionNeeded == 1) && playingNotesi == 3) returnValue = false;
+        if (!returnValue) println ("returning no on playingNotesi = " + playingNotesi + " and " + extentionNeeded);
+        return returnValue;
+    }
+ */   
+    
+//-------------------------------------------------------------------------------------------------------------------------------
+
+/*    public boolean disiredPitch(int pitch, int extension){  // returns a value for voice leading purposes.  If true then pitch is already in current chord
+        if (pitch % 12 == getExtentionPitch(extension) % 12)
+            return true;
+        else return false;
+    }
+  */ 
+    
+//-------------------------------------------------------------------------------------------------------------------------------
+
+  /*  public int getExtentionPitch(int extension){  //
+        if (!heresyMinor){
+            if (currentChord-tonic == 1)  return tritoneSystem[extension/2]+currentChord;
+            if (currentChord-tonic == 7)  return dom7System[extension/2]+currentChord;
+            if (currentChord-tonic != 1 || currentChord-tonic != 7) return major7System[extension/2]+currentChord;
+        }
+        if (heresyMinor)
+            return minorSystem[extension/2]+currentChord;
+        else
+            return -1;
+   }
+    */
+    
+    
+//-------------------------------------------------------------------------------------------------------------------------------
+
+ /*   public void extensionCounter(boolean positive, int currentDesiredExtention){
+        if (currentDesiredExtention == 1) if (positive) no1s++; else no1s--;
+        if (currentDesiredExtention == 3) if (positive) no3s++; else no3s--;
+        if (currentDesiredExtention == 5) if (positive) no5s++; else no5s--;
+        if (currentDesiredExtention == 7) if (positive) no7s++; else no7s--;
+        if (currentDesiredExtention == 9) if (positive) no9s++; else no9s--;
+        if (currentDesiredExtention == 11) if (positive) no11s++; else no11s--;
+        if (currentDesiredExtention == 13) if (positive) no13s++; else no13s--;
+    }
+ */                                   
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+    public void workOutExtensions(){  // calculates whether the performer wants chord extensions
+        if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[3])
+            tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] = null;
+        if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[2])
+            tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] = null;
+        if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[1])
+            tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] = null;
+        if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[0])
+            tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] = null;         
+
+        if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity > 0)
+            heresy7th = true;
+        if (tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[3][currentPulse%(tracks[0].loopLength)].noteVelocity == 0)
+            heresy7th = false;
+        if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity > 0)
+            heresy9th = true;
+        if (tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[2][currentPulse%(tracks[0].loopLength)].noteVelocity == 0)
+            heresy9th = false;    
+        if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity > 0)
+            heresy11th = true;
+        if (tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[1][currentPulse%(tracks[0].loopLength)].noteVelocity == 0)
+            heresy11th = false;
+        if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity > 0)
+            heresy13th = true;
+        if (tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[0][currentPulse%(tracks[0].loopLength)].noteVelocity == 0)
+            heresy13th = false;
+            //---
+        if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[3])
+            chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] = null;
+        if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[2])
+            chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] = null;
+        if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[1])
+            chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] = null;
+        if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0  && trSelected == 0 && noteOnArray[0])
+            chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] = null;         
+
+        if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0)
+            heresy7th = true;
+        if (chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[3][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0)
+            heresy7th = false;
+        if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0)
+            heresy9th = true;
+        if (chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[2][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0)
+            heresy9th = false;    
+        if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0)
+            heresy11th = true;
+        if (chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[1][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0)
+            heresy11th = false;
+        if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0)
+            heresy13th = true;
+        if (chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[0][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0)
+            heresy13th = false;
+            
+    }
+    
+    
+//-------------------------------------------------------------------------------------------------------------------------------
+    
+    public void workOutChord(){ // calculates current chord and major minor tonality
+        for (int i = 4; i < 16; i++) {
+            if (tracks[0] != null){
+                if ((tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)] != null && tracks[0].sequence[i][currentPulse%(tracks[0].loopLength)].noteVelocity > 0 )||
+                   (chordsTemp.sequence[i][currentPulse%(tracks[0].loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0 )){
+                    currentChord = 15 - i;
+                    boolean iiDone = false;
+                    for (int ii = 0;; ii--){
+                        if (ii == 0 && iiDone)
+                            break;
+                        if (currentPulse%(tracks[0].loopLength)+ii  == 0)
+                            ii = tracks[0].loopLength+ii-1;
+                        if (i > 3){
+                            if ((tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii] != null && tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii].noteVelocity == 0 ) ||
+                                 (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity == 0 ))
+                                 break;
+                            if ((tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii] != null && tracks[0].sequence[i-1][currentPulse%(tracks[0].loopLength)+ii].noteVelocity != 0 ) ||
+                                 (chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii] != null && chordsTemp.sequence[i-1][currentPulse%(chordsTemp.loopLength)+ii].noteVelocity != 0 )){
+                                heresyMinor = true;
+                                break;
+                            }else
+                                heresyMinor = false;
+                        }
+                        iiDone = true;
+                    }
+                }
+            }
+        }
+    }
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+    
+    public void heresyChangeHistory(){  // remembers whether the chords or extensions have changed
+        if (currentChord != lastChord){
+            heresyChordChanged = true;
+            lastChord = currentChord;
+            heresyChange = true; 
+        }
+        if (heresyMinor != oldHeresyMinor){
+            heresyMinorChanged = true;
+            oldHeresyMinor = heresyMinor;
+            heresyChange = true;
+        }
+        if (heresy7th != oldHeresy7th){
+            heresy7thChanged = true;
+            oldHeresy7th = heresy7th;
+            heresyChange = true;
+        }
+        if (heresy9th != oldHeresy9th){
+            heresy9thChanged = true;
+            oldHeresy9th = heresy9th;
+            heresyChange = true;
+        }
+        if (heresy11th != oldHeresy11th){
+            heresy11thChanged = true;
+            oldHeresy11th = heresy11th;
+            heresyChange = true;
+        }
+        if (heresy13th != oldHeresy13th){
+            heresy13thChanged = true;
+            oldHeresy13th = heresy13th;
+            heresyChange = true;
+        }
+    }
+
+
+      
+       
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/HeresyBigBangDone.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,287 @@
+ 
+
+void setup(){
+    markovStuff();
+    for (int i = 0; i < 16; i++)
+        VPA[i] = new VPArray(); // creates the virtual playing array for Heresy AI.
+    for (int i = 0; i < noteOnArray.length; i++)   
+        noteOnArray[i] = false; // makes sure there are initial random inputs from openFrameworks
+        
+    oscP5return = new OscP5(this,12345); 
+ 
+    frameRate(tempo);
+    img = createGraphics(imageWidth,imageHeight,P2D);
+    size(800,imageHeight,P2D);
+    arial = createFont("Arial",32);
+    textFont(arial,15);
+    
+    // initialize the tracks
+    
+    tracks[0] = new Track("Chord track", true, grid * beatsPerBar, 8, true, true);
+    tracks[1] = new Track("Drums", true, grid * beatsPerBar, 8, false, true);
+    tracks[2] = new Track("Bass", true, grid * beatsPerBar, 8, false, true);
+    tracks[3] = new Track("Pizz Strings", true, grid * beatsPerBar, 8, false, true);
+    tracks[4] = new Track("Synth", true, grid * beatsPerBar, 8, false, true);
+    tracks[5] = new Track("Voice", true, grid * beatsPerBar, 8, false, true);
+    chordsTemp = new Track("Chord track", true, loopLength, 8, true, false);
+    trSelected = 1;
+    backgroundColour();
+    drawLines();
+    drawBarLines();
+    imgNoteFan = createGraphics(fanWidth,imageHeight,P2D);
+    lastTrack = trSelected;
+    clickTrackOn = true;
+ //   loadSequences();
+ //   tracks[2].sequence[15][16] = new NoteEvent (14, 2, bar,beat,fraction,pulse);
+ //   tracks[2].sequence[15][grid * beatsPerBar -20] = new NoteEvent (14, 2, bar,beat,fraction,pulse, true);
+  
+ //   tracks[3].sequence[13][16] = new NoteEvent (13, 3, bar,beat,fraction,pulse);
+ //   tracks[3].sequence[13][20] = new NoteEvent (13, 3, bar,beat,fraction,pulse, true); 
+ //   tracks[3].sequence[12][16] = new NoteEvent (12, 3, bar,beat,fraction,pulse);
+ //   tracks[3].sequence[12][20] = new NoteEvent (12, 3, bar,beat,fraction,pulse, true);     
+ //   tracks[3].sequence[11][16] = new NoteEvent (11, 3, bar,beat,fraction,pulse);
+ //   tracks[3].sequence[11][20] = new NoteEvent (11, 3, bar,beat,fraction,pulse, true);   
+ //   tracks[3].sequence[10][16] = new NoteEvent (10, 3, bar,beat,fraction,pulse);
+ //   tracks[3].sequence[10][20] = new NoteEvent (10, 3, bar,beat,fraction,pulse, true);  
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void draw(){
+ /*   if (currentPulse % (grid * beatsPerBar) == grid * beatsPerBar -1){
+        int tempTrackSelected = trSelected;
+        for (int j = 0; j < 16; j++){
+            trSelected = j; 
+            if (tracks[j] != null){
+                for (int i = 0; i < 16; i++){
+                    noteOnArray[i] = false;
+                    finishNote(i);
+                    displayNoteOnArray[i] = false;
+                    for (int z = 24; z < 109; z++)
+                        outputToMax(z, 0, j);
+                }
+                tracks[j] = new Track(tracks[j].name, true,  tracks[j].loopLength, tracks[j].quantize, false, false);
+                imgNotes = null;
+            }
+        }
+        trSelected = tempTrackSelected;
+    }
+    */
+  //  tracks[0] = new Track("Chord track", true, grid * beatsPerBar, 8, true, true);
+  //  tracks[1] = new Track("Drums", true, grid * beatsPerBar, 8, false, true);
+  //  tracks[2] = new Track("Bass", true, grid * beatsPerBar, 8, false, true);
+  //  tracks[3] = new Track("Pizz Strings", true, grid * beatsPerBar, 8, false, true);
+  //  tracks[4] = new Track("Synth", true, grid * beatsPerBar, 8, false, true);
+  //  tracks[5] = new Track("Voice", true, grid * beatsPerBar, 8, false, true);
+  //  }
+    workOutPosition(); // calculates current bar, beat and pulse position
+    //println(bar + " " + beat + " " + fraction + " " + pulse);
+//    if (chordAI && bar > 1)
+//        chordCalc();
+    if (eraseOn)
+        eraseNotes();
+    calcColours(); // calcs chord colours for background and grid
+    heresyChange = false;
+    heresyChordChanged = false;
+    if (trackStorer != trSelected){ // resets display when changing tracks
+        for (int i = 0; i < 16; i++)
+            if (noteOnArray[i] = true){
+                noteOnArray[i] = false;
+                displayNoteOnArray[i] = false;
+            }
+        trackStorer = trSelected;    
+        imgNotes = null;
+    }
+    if (imgNotes == null)
+        imgNotes = createGraphics(tracks[trSelected].loopLength,imageHeight,P2D);
+    background(0);
+    image (img,width-x2-playArea,0);
+    drawTempImageGrid();
+    createNoteFan(); 
+    drawNotes();
+    fill (0);
+    noStroke();
+    rect (width-playArea,0,playArea,height);
+    image (imgNoteFan, width-playArea+3,0);
+    pulseFrame(x); // Draws a pulsing white line at the left edge of the edit area
+    if (haveQuestion) writeQuestion(); // for input request messages
+    x++; // counter for grid movement
+    x2++; // counter for note image movement
+    if (x2 == width - playArea + grid * beatsPerBar)
+        x2 = width - playArea;
+    if (x == width - playArea + tracks[trSelected].loopLength)
+        x = width - playArea;
+
+    
+   /* if (clickTrackOn){ // click track
+        if (fraction == 1){
+            if (pulse == 1){
+                String noteOut = ("37 80 1");
+                link.output(noteOut);
+            }
+            if (pulse == 2){
+                String noteOut = ("37 0 1" );
+                link.output(noteOut); 
+            } 
+        }
+    }
+    */
+    checkForMutes();
+    checkCycled();
+    playTrackEvents();
+
+    fill(255,255,255);
+    textSize(15);
+    text(bar + " " + beat + " " + fraction + " " + pulse, 10,20); // draws current time position to screen
+
+    fill(200,0,0);
+    textSize(15);
+    // this section draws current track and track info to screen
+    if (tracks[trSelected].ducking) 
+        text(tracks[trSelected].name + " ducking", 100,20); 
+    else
+        text(tracks[trSelected].name, 100,20); 
+    if (tracks[trSelected].muteIn > bar)
+        if (!tracks[trSelected].mute)
+             text("mute in " + (tracks[trSelected].muteIn - bar), 200,20);
+         else 
+             text("unmute in " + (tracks[trSelected].muteIn - bar), 200,20);
+             
+    if (haveQuestion){ // asks input questions
+        writeQuestion();
+    }
+ //   println(currentPulse + " ");
+
+
+    currentPulse++; // advances the sequencer to next pulse
+}
+        
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void eraseNotes(){ // erases notes in current track if selected
+    if (trSelected != 0){
+        for (int i = 0; i < 16; i++){
+           if (tracks[trSelected].sequence[i][(currentPulse%(tracks[trSelected].loopLength))] != null){
+               tracks[trSelected].sequence[i][(currentPulse%(tracks[trSelected].loopLength))] = null;
+           }
+        }
+    }
+    if (trSelected == 0){
+        for (int i = 0; i < 16; i++){
+           if (chordsTemp.sequence[i][(currentPulse%(tracks[trSelected].loopLength))] != null){
+               chordsTemp.sequence[i][(currentPulse%(tracks[trSelected].loopLength))] = null;
+           }
+        }
+    }     
+}  
+           
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void workOutPosition(){ // works out current position
+  if (currentPulse%(grid*beatsPerBar) == 0)
+    ++bar;
+  if (currentPulse%grid == 0)
+    ++beat;
+  if (beat > beatsPerBar)
+    beat = 1;
+  if (currentPulse%(grid/fractions) == 0)
+    ++fraction;
+  if (fraction > fractions)
+    fraction = 1;
+    ++pulse;
+  if (pulse > (grid/fractions))
+    pulse = 1;
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void finishNote(int noteArrayPosition){ // writes note offs into the sequencers
+  if (trSelected != 0)
+      tracks[trSelected].sequence[noteArrayPosition][(currentPulse%(tracks[trSelected].loopLength))] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse, true);
+  if (trSelected == 0)
+      chordsTemp.sequence[noteArrayPosition][(currentPulse%(chordsTemp.loopLength))] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse, true);
+  displayNoteOnArray[noteArrayPosition] = false;
+}
+
+public void finishNote(int noteArrayPosition, int channel){ // writes note offs into the sequencers
+  if (trSelected != 0)
+      tracks[trSelected].sequence[noteArrayPosition][(currentPulse%(tracks[trSelected].loopLength))] = new NoteEvent (noteArrayPosition, channel, bar,beat,fraction,pulse, true);
+  if (trSelected == 0)
+      chordsTemp.sequence[noteArrayPosition][(currentPulse%(chordsTemp.loopLength))] = new NoteEvent (noteArrayPosition, channel, bar,beat,fraction,pulse, true);
+  displayNoteOnArray[noteArrayPosition] = false;
+}
+
+
+//-----------------------------------------------------------------------------------------------------------------------------
+
+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
+    tracks[lastTrack].sequence[noteArrayPosition][(currentPulse%(tracks[lastTrack].loopLength))] = new NoteEvent (noteArrayPosition, lastTrack+1, bar,beat,fraction,pulse, true);
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public void writeNote(int noteArrayPosition, int veloc){ // writes note ons into the sequencers
+    if (trSelected != 0){
+        int quantizeOffset = getQuantizeOffset();
+        if (quantizeOffset >= 0){
+            tracks[trSelected].sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse);
+        }
+        if (quantizeOffset < 0){
+            tracks[trSelected].sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse);  
+
+            VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNoteOn = true;
+            if (trSelected !=1 && trSelected !=5)
+                VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 3);
+            else
+                VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 1);
+            VPA[trSelected].VPArrayNotes[noteArrayPosition].VPNoteVelocity = veloc;
+            sendNote(VPA[trSelected].VPArrayNotes[noteArrayPosition], trSelected);
+            displayNoteOnArray[noteArrayPosition] = true;
+            
+        }
+    }
+    if (trSelected == 0){
+        int quantizeOffset = getQuantizeOffset();
+        if (quantizeOffset >= 0){
+            chordsTemp.sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse);
+        }
+        if (quantizeOffset < 0){
+            chordsTemp.sequence[noteArrayPosition][(currentPulse+quantizeOffset)%(tracks[trSelected].loopLength)] = new NoteEvent (noteArrayPosition, trSelected+1, bar,beat,fraction,pulse);  
+
+            if (noteArrayPosition > 3)
+                currentChord = 15 - noteArrayPosition;
+             displayNoteOnArray[noteArrayPosition] = true;
+        }
+    }
+}
+
+public void writeNote(int noteArrayPosition, int veloc, int channel){ // writes note ons into the sequencers
+    VPA[channel].VPArrayNotes[noteArrayPosition].VPNoteOn = true;
+    VPA[channel].VPArrayNotes[noteArrayPosition].VPNotePitch = heresyPitch(noteArrayPosition, 1);
+    VPA[channel].VPArrayNotes[noteArrayPosition].VPNoteVelocity = veloc;
+    sendNote(VPA[channel].VPArrayNotes[noteArrayPosition], channel);
+}
+
+
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+public int getQuantizeOffset(){  // tells write note method the quantize offset.
+    int quantizeInPulses = pulsesPerBar/(tracks[trSelected].quantize);
+    int quantizeOffset = currentPulse % quantizeInPulses;
+    if (quantizeOffset > quantizeInPulses/2.0){
+        return ((quantizeOffset - quantizeInPulses) * -1) ;
+    }
+    else{
+        return quantizeOffset * -1;
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/HeresyVoicingTables.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,244 @@
+// the main voicing tables for chords requested
+
+// root position
+
+int[] hchoice135 = new int[]  {24,  36,  43,  48,  52,  55,  60,  64,  67,  72,  76,  79,  84,  88,  91,  96};
+int[] hchoice7 = new int[]    {24,  36,  43,  48,  52,  55,  59,  64,  67,  71,  72,  76,  79,  83,  88,  95};
+int[] hchoice9 = new int[]    {24,  36,  43,  48,  50,  52,  55,  60,  62,  64,  67,  74,  76,  79,  86,  91};
+int[] hchoice11 = new int[]   {24,  36,  43,  48,  53,  55,  60,  65,  67,  72,  77,  79,  84,  89,  91,  96};
+int[] hchoice13 = new int[]   {24,  36,  43,  48,  52,  55,  57,  60,  64,  69,  72,  76,  81,  84,  88,  93};
+int[] hchoice79 = new int[]   {24,  36,  43,  48,  52,  55,  57,  59,  62,  64,  69,  71,  74,  76,  83,  86};
+int[] hchoice711 = new int[]  {24,  36,  43,  48,  53,  55,  59,  60,  65,  67,  71,  72,  77,  83,  88,  95}; //nice
+int[] hchoice713 = new int[]  {24,  36,  43,  48,  52,  57,  59,  64,  69,  71,  76,  79,  81,  83,  88,  93};
+int[] hchoice911 = new int[]  {24,  36,  43,  48,  53,  55,  60,  62,  65,  67,  74,  77,  79,  86,  89,  96};
+int[] hchoice913 = new int[]  {24,  36,  43,  48,  50,  57,  60,  62,  69,  72,  74,  81,  84,  86,  93,  96};
+int[] hchoice1113 = new int[] {24,  36,  43,  48,  52,  53,  57,  60,  64,  65,  69,  72,  77,  81,  84,  93}; //nice
+int[] hchoice7911 = new int[] {24,  36,  43,  48,  55,  62,  65,  71,  77,  79,  83,  84,  86,  89,  91,  96};
+int[] hchoice7913 = new int[] {24,  36,  43,  48,  59,  62,  69,  71,  74,  81,  83,  84,  86,  93,  95,  96};
+int[] hchoice71113 = new int[]{24,  36,  43,  48,  55,  59,  65,  69,  76,  77,  79,  84,  88,  89,  93,  96};
+int[] hchoice91113 = new int[]{24,  36,  48,  50,  53,  57,  60,  62,  65,  69,  72,  74,  77,  81,  89,  96};
+int[] hchoice791113 = new int[]{24,  36,  50,  53,  58,  62,  65,  70,  74,  77,  82,  84,  86,  89,  94,  96}; //dom7th full sus chord
+
+int[] mhchoice135 = new int[]  {24,  36,  43,  48,  51,  55,  60,  63,  67,  72,  75,  79,  84,  87,  91,  96};//
+int[] mhchoice7 = new int[]    {24,  36,  43,  48,  51,  55,  58,  63,  67,  70,  72,  75,  79,  82,  87,  94};//
+int[] mhchoice9 = new int[]    {24,  36,  43,  48,  50,  51,  55,  60,  62,  63,  67,  72,  74,  79,  86,  91};//
+int[] mhchoice11 = new int[]   {24,  36,  43,  48,  51,  53,  55,  60,  63,  65,  67,  72,  77,  79,  84,  89};//
+int[] mhchoice13 = new int[]   {24,  36,  43,  48,  51,  55,  57,  60,  63,  67,  69,  72,  75,  81,  84,  91};//
+int[] mhchoice79 = new int[]   {24,  36,  43,  50,  51,  55,  57,  58,  62,  63,  69,  70,  74,  75,  82,  86};//
+int[] mhchoice711 = new int[]  {24,  36,  43,  51,  58,  63,  65,  69,  72,  75,  77,  79,  82,  84,  89,  96};// 
+int[] mhchoice713 = new int[]  {24,  36,  43,  48,  55,  58,  59,  63,  69,  75,  79,  81,  82,  84,  93,  96};//
+int[] mhchoice911 = new int[]  {24,  36,  43,  48,  51,  53,  62,  63,  65,  67,  74,  77,  79,  86,  89,  96};//
+int[] mhchoice913 = new int[]  {24,  36,  43,  51,  57,  62,  63,  69,  74,  75,  81,  84,  86,  87,  93,  96};//
+int[] mhchoice1113 = new int[] {24,  36,  43,  53,  57,  63,  67,  72,  75,  77,  79,  81,  84,  87,  93,  96};// 
+int[] mhchoice7911 = new int[] {24,  36,  43,  50,  51,  58,  65,  67,  70,  72,  74,  75,  77,  79,  82,  86};//
+int[] mhchoice7913 = new int[] {24,  36,  48,  55,  58,  62,  63,  69,  70,  74,  75,  79,  81,  84,  93,  96};//
+int[] mhchoice71113 = new int[]{24,  36,  43,  48,  53,  58,  63,  65,  69,  72,  75,  77,  81,  84,  91,  96};//
+int[] mhchoice91113 = new int[]{24,  36,  48,  50,  53,  57,  60,  62,  65,  69,  72,  74,  77,  81,  89,  96};//
+int[] mhchoice791113 = new int[]{24,  36,  50,  53,  58,  62,  65,  70,  74,  77,  82,  84,  86,  89,  94,  96}; //dom7th full sus chord
+
+// first inversion
+
+int[] h1choice135 = new int[]  {24,  36,  40,  43,  48,  52,  55,  60,  64,  67,  72,  76,  79,  84,  88,  91};
+int[] h1choice7 = new int[]    {24,  36,  40,  43,  48,  52,  55,  59,  64,  67,  71,  72,  76,  79,  83,  88};
+int[] h1choice9 = new int[]    {24,  36,  38,  43,  48,  50,  52,  55,  60,  62,  64,  67,  74,  76,  79,  86};
+int[] h1choice11 = new int[]   {24,  36,  41,  43,  48,  53,  55,  60,  65,  67,  72,  77,  79,  84,  89,  91};
+int[] h1choice13 = new int[]   {24,  36,  40,  43,  48,  52,  55,  57,  60,  64,  69,  72,  76,  81,  84,  88};
+int[] h1choice79 = new int[]   {24,  36,  40,  43,  48,  52,  55,  57,  59,  62,  64,  69,  71,  74,  76,  83};
+int[] h1choice711 = new int[]  {24,  36,  41,  43,  48,  53,  55,  59,  60,  65,  67,  71,  72,  77,  83,  88}; //nice
+int[] h1choice713 = new int[]  {24,  36,  40,  43,  48,  52,  57,  59,  64,  69,  71,  76,  79,  81,  83,  88};
+int[] h1choice911 = new int[]  {24,  36,  41,  43,  48,  53,  55,  60,  62,  65,  67,  74,  77,  79,  86,  89};
+int[] h1choice913 = new int[]  {24,  36,  43,  45,  48,  50,  57,  60,  62,  69,  72,  74,  81,  84,  86,  93};
+int[] h1choice1113 = new int[] {24,  36,  40,  43,  48,  52,  53,  57,  60,  64,  65,  69,  72,  77,  81,  84}; //nice
+int[] h1choice7911 = new int[] {24,  36,  43,  48,  50,  55,  62,  65,  71,  77,  79,  83,  84,  86,  89,  91};
+int[] h1choice7913 = new int[] {24,  36,  43,  48,  55,  59,  62,  69,  71,  74,  81,  83,  84,  86,  93,  95};
+int[] h1choice71113 = new int[]{24,  36,  43,  48,  53,  55,  59,  65,  69,  76,  77,  79,  84,  88,  89,  93};
+int[] h1choice91113 = new int[]{24,  36,  41,  48,  50,  53,  57,  60,  62,  65,  69,  72,  74,  77,  81,  89};
+int[] h1choice791113 = new int[]{24,  36,  43,  50,  53,  58,  62,  65,  70,  74,  77,  82,  84,  86,  89,  94}; //dom7th full sus chord
+
+int[] m1hchoice135 = new int[]  {24,  36,  39,  43,  48,  51,  55,  60,  63,  67,  72,  75,  79,  84,  87,  91};//
+int[] m1hchoice7 = new int[]    {24,  36,  39,  43,  48,  51,  55,  58,  63,  67,  70,  72,  75,  79,  82,  87};//
+int[] m1hchoice9 = new int[]    {24,  36,  38,  43,  48,  50,  51,  55,  60,  62,  63,  67,  72,  74,  79,  86};//
+int[] m1hchoice11 = new int[]   {24,  36,  39,  43,  48,  51,  53,  55,  60,  63,  65,  67,  72,  77,  79,  84};//
+int[] m1hchoice13 = new int[]   {24,  36,  39,  43,  48,  51,  55,  57,  60,  63,  67,  69,  72,  75,  81,  84};//
+int[] m1hchoice79 = new int[]   {24,  36,  39,  43,  50,  51,  55,  57,  58,  62,  63,  69,  70,  74,  75,  82};//
+int[] m1hchoice711 = new int[]  {24,  36,  43,  46,  51,  58,  63,  65,  69,  72,  75,  77,  79,  82,  84,  89};// 
+int[] m1hchoice713 = new int[]  {24,  36,  43,  46,  48,  55,  58,  59,  63,  69,  75,  79,  81,  82,  84,  93};//
+int[] m1hchoice911 = new int[]  {24,  36,  39,  43,  48,  51,  53,  62,  63,  65,  67,  74,  77,  79,  86,  89};//
+int[] m1hchoice913 = new int[]  {24,  36,  43,  48,  51,  57,  62,  63,  69,  74,  75,  81,  84,  86,  87,  93};//
+int[] m1hchoice1113 = new int[] {24,  36,  43,  45,  53,  57,  63,  67,  72,  75,  77,  79,  81,  84,  87,  93};// 
+int[] m1hchoice7911 = new int[] {24,  36,  39,  43,  50,  51,  58,  65,  67,  70,  72,  74,  75,  77,  79,  82};//
+int[] m1hchoice7913 = new int[] {24,  36,  43,  48,  55,  58,  62,  63,  69,  70,  74,  75,  79,  81,  84,  93};//
+int[] m1hchoice71113 = new int[]{24,  36,  43,  46,  48,  53,  58,  63,  65,  69,  72,  75,  77,  81,  84,  91};//
+int[] m1hchoice91113 = new int[]{24,  36,  41,  48,  50,  53,  57,  60,  62,  65,  69,  72,  74,  77,  81,  89};//
+int[] m1hchoice791113 = new int[]{24,  36,  46,  50,  53,  58,  62,  65,  70,  74,  77,  82,  84,  86,  89,  94}; //dom7th full sus chord
+
+// second inversion
+
+int[] h2choice135 = new int[]  {24,  31,  36,  40,  43,  48,  52,  55,  60,  64,  67,  72,  76,  79,  84,  88};
+int[] h2choice7 = new int[]    {24,  31,  36,  40,  43,  48,  52,  55,  59,  64,  67,  71,  72,  76,  79,  83};
+int[] h2choice9 = new int[]    {24,  31,  36,  38,  43,  48,  50,  52,  55,  60,  62,  64,  67,  74,  76,  79};
+int[] h2choice11 = new int[]   {24,  31,  36,  41,  43,  48,  53,  55,  60,  65,  67,  72,  77,  79,  84,  89};
+int[] h2choice13 = new int[]   {24,  31,  36,  40,  43,  48,  52,  55,  57,  60,  64,  69,  72,  76,  81,  84};
+int[] h2choice79 = new int[]   {24,  31,  36,  40,  43,  48,  52,  55,  57,  59,  62,  64,  69,  71,  74,  76};
+int[] h2choice711 = new int[]  {24,  31,  36,  41,  43,  48,  53,  55,  59,  60,  65,  67,  71,  72,  77,  83}; //nice
+int[] h2choice713 = new int[]  {24,  31,  36,  40,  43,  48,  52,  57,  59,  64,  69,  71,  76,  79,  81,  83};
+int[] h2choice911 = new int[]  {24,  31,  36,  41,  43,  48,  53,  55,  60,  62,  65,  67,  74,  77,  79,  86};
+int[] h2choice913 = new int[]  {24,  31,  36,  43,  45,  48,  50,  57,  60,  62,  69,  72,  74,  81,  84,  86};
+int[] h2choice1113 = new int[] {24,  31,  36,  40,  43,  48,  52,  53,  57,  60,  64,  65,  69,  72,  77,  81}; //nice
+int[] h2choice7911 = new int[] {24,  31,  36,  43,  48,  50,  55,  62,  65,  71,  77,  79,  83,  84,  86,  89};
+int[] h2choice7913 = new int[] {24,  31,  36,  43,  48,  55,  59,  62,  69,  71,  74,  81,  83,  84,  86,  93};
+int[] h2choice71113 = new int[]{24,  31,  36,  43,  48,  53,  55,  59,  65,  69,  76,  77,  79,  84,  88,  89};
+int[] h2choice91113 = new int[]{24,  31,  36,  41,  48,  50,  53,  57,  60,  62,  65,  69,  72,  74,  77,  81};
+int[] h2choice791113 = new int[]{24,  31,  36,  43,  50,  53,  58,  62,  65,  70,  74,  77,  82,  84,  86,  89}; //dom7th full sus chord
+
+int[] m2hchoice135 = new int[]  {24,  31,  36,  39,  43,  48,  51,  55,  60,  63,  67,  72,  75,  79,  84,  87};//
+int[] m2hchoice7 = new int[]    {24,  31,  36,  39,  43,  48,  51,  55,  58,  63,  67,  70,  72,  75,  79,  82};//
+int[] m2hchoice9 = new int[]    {24,  31,  36,  38,  43,  48,  50,  51,  55,  60,  62,  63,  67,  72,  74,  79};//
+int[] m2hchoice11 = new int[]   {24,  31,  36,  39,  43,  48,  51,  53,  55,  60,  63,  65,  67,  72,  77,  79};//
+int[] m2hchoice13 = new int[]   {24,  31,  36,  39,  43,  48,  51,  55,  57,  60,  63,  67,  69,  72,  75,  81};//
+int[] m2hchoice79 = new int[]   {24,  31,  36,  39,  43,  50,  51,  55,  57,  58,  62,  63,  69,  70,  74,  75};//
+int[] m2hchoice711 = new int[]  {24,  31,  36,  43,  46,  51,  58,  63,  65,  69,  72,  75,  77,  79,  82,  84};// 
+int[] m2hchoice713 = new int[]  {24,  31,  36,  43,  46,  48,  55,  58,  59,  63,  69,  75,  79,  81,  82,  84};//
+int[] m2hchoice911 = new int[]  {24,  31,  36,  39,  43,  48,  51,  53,  62,  63,  65,  67,  74,  77,  79,  86};//
+int[] m2hchoice913 = new int[]  {24,  31,  36,  43,  48,  51,  57,  62,  63,  69,  74,  75,  81,  84,  86,  87};//
+int[] m2hchoice1113 = new int[] {24,  31,  36,  43,  45,  53,  57,  63,  67,  72,  75,  77,  79,  81,  84,  87};// 
+int[] m2hchoice7911 = new int[] {24,  31,  36,  39,  43,  50,  51,  58,  65,  67,  70,  72,  74,  75,  77,  79};//
+int[] m2hchoice7913 = new int[] {24,  31,  36,  43,  48,  55,  58,  62,  63,  69,  70,  74,  75,  79,  81,  84};//
+int[] m2hchoice71113 = new int[]{24,  31,  36,  43,  46,  48,  53,  58,  63,  65,  69,  72,  75,  77,  81,  84};//
+int[] m2hchoice91113 = new int[]{24,  31,  36,  41,  48,  50,  53,  57,  60,  62,  65,  69,  72,  74,  77,  81};//
+int[] m2hchoice791113 = new int[]{24,  31,  36,  46,  50,  53,  58,  62,  65,  70,  74,  77,  82,  84,  86,  89}; //dom7th full sus chord
+
+int[] hvArray;
+int[] minorSystem = new int[] {0, 3, 7, 10, 14, 17, 21};
+int[] major7System = new int[] {0, 4, 7, 11, 14, 18, 21};
+int[] dom7System = new int[] {0, 4, 7, 10, 14, 17, 21};
+int[] tritoneSystem = new int[] {0, 4, 7, 10, 14, 18, 21};
+
+public int heresyPitch(int arrayPosition, int heresyChannel){  //  calculates the pitch value to be returned for playback.
+    boolean m = heresyMinor;
+    boolean e7 = heresy7th;
+    boolean e9 = heresy9th;
+    boolean e11 = heresy11th;
+    boolean e13 = heresy13th;
+    int returnInt = 0;
+    if ((currentChord % 12) > -1 && (currentChord % 12) < 4){
+        if (!m && !e7 && !e9 && !e11 && !e13) returnInt = hchoice135[15 - arrayPosition];
+        if (!m &&  e7 && !e9 && !e11 && !e13) returnInt = hchoice7[15 - arrayPosition];
+        if (!m && !e7 &&  e9 && !e11 && !e13) returnInt = hchoice9[15 - arrayPosition];
+        if (!m && !e7 && !e9 &&  e11 && !e13) returnInt = hchoice11[15 - arrayPosition];
+        if (!m && !e7 && !e9 && !e11 &&  e13) returnInt = hchoice13[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 && !e11 && !e13) returnInt = hchoice79[15 - arrayPosition]; 
+        if (!m &&  e7 && !e9 &&  e11 && !e13) returnInt = hchoice711[15 - arrayPosition]; 
+        if (!m &&  e7 && !e9 && !e11 &&  e13) returnInt = hchoice713[15 - arrayPosition];
+        if (!m && !e7 &&  e9 &&  e11 && !e13) returnInt = hchoice911[15 - arrayPosition];
+        if (!m && !e7 &&  e9 && !e11 &&  e13) returnInt = hchoice913[15 - arrayPosition];
+        if (!m && !e7 && !e9 &&  e11 &&  e13) returnInt = hchoice1113[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 &&  e11 && !e13) returnInt = hchoice7911[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 && !e11 &&  e13) returnInt = hchoice7913[15 - arrayPosition];
+        if (!m &&  e7 && !e9 &&  e11 &&  e13) returnInt = hchoice71113[15 - arrayPosition];
+        if (!m && !e7 &&  e9 &&  e11 &&  e13) returnInt = hchoice91113[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 &&  e11 &&  e13) returnInt = hchoice791113[15 - arrayPosition];
+    
+        if (m && !e7 && !e9 && !e11 && !e13) returnInt = mhchoice135[15 - arrayPosition];
+        if (m &&  e7 && !e9 && !e11 && !e13) returnInt = mhchoice7[15 - arrayPosition];
+        if (m && !e7 &&  e9 && !e11 && !e13) returnInt = mhchoice9[15 - arrayPosition];
+        if (m && !e7 && !e9 &&  e11 && !e13) returnInt = mhchoice11[15 - arrayPosition];
+        if (m && !e7 && !e9 && !e11 &&  e13) returnInt = mhchoice13[15 - arrayPosition];
+        if (m &&  e7 &&  e9 && !e11 && !e13) returnInt = mhchoice79[15 - arrayPosition]; 
+        if (m &&  e7 && !e9 &&  e11 && !e13) returnInt = mhchoice711[15 - arrayPosition]; 
+        if (m &&  e7 && !e9 && !e11 &&  e13) returnInt = mhchoice713[15 - arrayPosition];
+        if (m && !e7 &&  e9 &&  e11 && !e13) returnInt = mhchoice911[15 - arrayPosition];
+        if (m && !e7 &&  e9 && !e11 &&  e13) returnInt = mhchoice913[15 - arrayPosition];
+        if (m && !e7 && !e9 &&  e11 &&  e13) returnInt = mhchoice1113[15 - arrayPosition];
+        if (m &&  e7 &&  e9 &&  e11 && !e13) returnInt = mhchoice7911[15 - arrayPosition];
+        if (m &&  e7 &&  e9 && !e11 &&  e13) returnInt = mhchoice7913[15 - arrayPosition];
+        if (m &&  e7 && !e9 &&  e11 &&  e13) returnInt = mhchoice71113[15 - arrayPosition];
+        if (m && !e7 &&  e9 &&  e11 &&  e13) returnInt = mhchoice91113[15 - arrayPosition];
+        if (m &&  e7 &&  e9 &&  e11 &&  e13) returnInt = mhchoice791113[15 - arrayPosition];
+    }
+    
+        if ((currentChord % 12) > 3 && (currentChord % 12) < 8){
+        if (!m && !e7 && !e9 && !e11 && !e13) returnInt = h1choice135[15 - arrayPosition];
+        if (!m &&  e7 && !e9 && !e11 && !e13) returnInt = h1choice7[15 - arrayPosition];
+        if (!m && !e7 &&  e9 && !e11 && !e13) returnInt = h1choice9[15 - arrayPosition];
+        if (!m && !e7 && !e9 &&  e11 && !e13) returnInt = h1choice11[15 - arrayPosition];
+        if (!m && !e7 && !e9 && !e11 &&  e13) returnInt = h1choice13[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 && !e11 && !e13) returnInt = h1choice79[15 - arrayPosition]; 
+        if (!m &&  e7 && !e9 &&  e11 && !e13) returnInt = h1choice711[15 - arrayPosition]; 
+        if (!m &&  e7 && !e9 && !e11 &&  e13) returnInt = h1choice713[15 - arrayPosition];
+        if (!m && !e7 &&  e9 &&  e11 && !e13) returnInt = h1choice911[15 - arrayPosition];
+        if (!m && !e7 &&  e9 && !e11 &&  e13) returnInt = h1choice913[15 - arrayPosition];
+        if (!m && !e7 && !e9 &&  e11 &&  e13) returnInt = h1choice1113[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 &&  e11 && !e13) returnInt = h1choice7911[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 && !e11 &&  e13) returnInt = h1choice7913[15 - arrayPosition];
+        if (!m &&  e7 && !e9 &&  e11 &&  e13) returnInt = h1choice71113[15 - arrayPosition];
+        if (!m && !e7 &&  e9 &&  e11 &&  e13) returnInt = h1choice91113[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 &&  e11 &&  e13) returnInt = h1choice791113[15 - arrayPosition];
+    
+        if (m && !e7 && !e9 && !e11 && !e13) returnInt = m1hchoice135[15 - arrayPosition];
+        if (m &&  e7 && !e9 && !e11 && !e13) returnInt = m1hchoice7[15 - arrayPosition];
+        if (m && !e7 &&  e9 && !e11 && !e13) returnInt = m1hchoice9[15 - arrayPosition];
+        if (m && !e7 && !e9 &&  e11 && !e13) returnInt = m1hchoice11[15 - arrayPosition];
+        if (m && !e7 && !e9 && !e11 &&  e13) returnInt = m1hchoice13[15 - arrayPosition];
+        if (m &&  e7 &&  e9 && !e11 && !e13) returnInt = m1hchoice79[15 - arrayPosition]; 
+        if (m &&  e7 && !e9 &&  e11 && !e13) returnInt = m1hchoice711[15 - arrayPosition]; 
+        if (m &&  e7 && !e9 && !e11 &&  e13) returnInt = m1hchoice713[15 - arrayPosition];
+        if (m && !e7 &&  e9 &&  e11 && !e13) returnInt = m1hchoice911[15 - arrayPosition];
+        if (m && !e7 &&  e9 && !e11 &&  e13) returnInt = m1hchoice913[15 - arrayPosition];
+        if (m && !e7 && !e9 &&  e11 &&  e13) returnInt = m1hchoice1113[15 - arrayPosition];
+        if (m &&  e7 &&  e9 &&  e11 && !e13) returnInt = m1hchoice7911[15 - arrayPosition];
+        if (m &&  e7 &&  e9 && !e11 &&  e13) returnInt = m1hchoice7913[15 - arrayPosition];
+        if (m &&  e7 && !e9 &&  e11 &&  e13) returnInt = m1hchoice71113[15 - arrayPosition];
+        if (m && !e7 &&  e9 &&  e11 &&  e13) returnInt = m1hchoice91113[15 - arrayPosition];
+        if (m &&  e7 &&  e9 &&  e11 &&  e13) returnInt = m1hchoice791113[15 - arrayPosition];
+    }
+    
+        if ((currentChord % 12) > 7 && (currentChord % 12) < 12){
+        if (!m && !e7 && !e9 && !e11 && !e13) returnInt = h2choice135[15 - arrayPosition];
+        if (!m &&  e7 && !e9 && !e11 && !e13) returnInt = h2choice7[15 - arrayPosition];
+        if (!m && !e7 &&  e9 && !e11 && !e13) returnInt = h2choice9[15 - arrayPosition];
+        if (!m && !e7 && !e9 &&  e11 && !e13) returnInt = h2choice11[15 - arrayPosition];
+        if (!m && !e7 && !e9 && !e11 &&  e13) returnInt = h2choice13[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 && !e11 && !e13) returnInt = h2choice79[15 - arrayPosition]; 
+        if (!m &&  e7 && !e9 &&  e11 && !e13) returnInt = h2choice711[15 - arrayPosition]; 
+        if (!m &&  e7 && !e9 && !e11 &&  e13) returnInt = h2choice713[15 - arrayPosition];
+        if (!m && !e7 &&  e9 &&  e11 && !e13) returnInt = h2choice911[15 - arrayPosition];
+        if (!m && !e7 &&  e9 && !e11 &&  e13) returnInt = h2choice913[15 - arrayPosition];
+        if (!m && !e7 && !e9 &&  e11 &&  e13) returnInt = h2choice1113[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 &&  e11 && !e13) returnInt = h2choice7911[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 && !e11 &&  e13) returnInt = h2choice7913[15 - arrayPosition];
+        if (!m &&  e7 && !e9 &&  e11 &&  e13) returnInt = h2choice71113[15 - arrayPosition];
+        if (!m && !e7 &&  e9 &&  e11 &&  e13) returnInt = h2choice91113[15 - arrayPosition];
+        if (!m &&  e7 &&  e9 &&  e11 &&  e13) returnInt = h2choice791113[15 - arrayPosition];
+    
+        if (m && !e7 && !e9 && !e11 && !e13) returnInt = m2hchoice135[15 - arrayPosition];
+        if (m &&  e7 && !e9 && !e11 && !e13) returnInt = m2hchoice7[15 - arrayPosition];
+        if (m && !e7 &&  e9 && !e11 && !e13) returnInt = m2hchoice9[15 - arrayPosition];
+        if (m && !e7 && !e9 &&  e11 && !e13) returnInt = m2hchoice11[15 - arrayPosition];
+        if (m && !e7 && !e9 && !e11 &&  e13) returnInt = m2hchoice13[15 - arrayPosition];
+        if (m &&  e7 &&  e9 && !e11 && !e13) returnInt = m2hchoice79[15 - arrayPosition]; 
+        if (m &&  e7 && !e9 &&  e11 && !e13) returnInt = m2hchoice711[15 - arrayPosition]; 
+        if (m &&  e7 && !e9 && !e11 &&  e13) returnInt = m2hchoice713[15 - arrayPosition];
+        if (m && !e7 &&  e9 &&  e11 && !e13) returnInt = m2hchoice911[15 - arrayPosition];
+        if (m && !e7 &&  e9 && !e11 &&  e13) returnInt = m2hchoice913[15 - arrayPosition];
+        if (m && !e7 && !e9 &&  e11 &&  e13) returnInt = m2hchoice1113[15 - arrayPosition];
+        if (m &&  e7 &&  e9 &&  e11 && !e13) returnInt = m2hchoice7911[15 - arrayPosition];
+        if (m &&  e7 &&  e9 && !e11 &&  e13) returnInt = m2hchoice7913[15 - arrayPosition];
+        if (m &&  e7 && !e9 &&  e11 &&  e13) returnInt = m2hchoice71113[15 - arrayPosition];
+        if (m && !e7 &&  e9 &&  e11 &&  e13) returnInt = m2hchoice91113[15 - arrayPosition];
+        if (m &&  e7 &&  e9 &&  e11 &&  e13) returnInt = m2hchoice791113[15 - arrayPosition];
+    }
+    
+    if (heresyDom && returnInt % 12 == 11)
+        returnInt--;
+    returnInt = currentChord + returnInt;
+    
+  //  if (heresyChannel == 1 || heresyChannel == 5)
+  //      returnInt = 15 - arrayPosition + 36;
+        
+
+        
+    return returnInt;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/IO.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,389 @@
+void sendNote(VPNote note, int channel){ // send note function gathers info to output to max
+    outputToMax(note.VPNotePitch, note.VPNoteVelocity, channel);
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+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
+    String noteOut = "";
+    if (!tracks[channel].mute){
+        if (tracks[channel].ducking){
+            if (velocity != 0){
+                noteOut = ("" + note + " " + velocity + " " + (channel+8));
+            }
+            if (velocity == 0 && !tracks[channel].cycled){
+                noteOut = ("" + note + " " + velocity + " " + (channel+8));
+                  OscMessage message = new OscMessage("/pitch_vel_chan");
+                  message.add(noteOut);
+                  oscP5return.send(message, ableton);
+                link.output(noteOut);
+                noteOut = ("" + note + " " + velocity + " " + channel);
+            }
+            if (velocity == 0 && tracks[channel].cycled){
+                noteOut = ("" + note + " " + velocity + " " + (channel+8));      
+            }
+        }
+        if (!tracks[channel].ducking){
+            if (velocity != 0){
+                noteOut = ("" + note + " " + velocity + " " + channel);
+            }
+            if (velocity == 0 && !tracks[channel].cycled){
+                noteOut = ("" + note + " " + velocity + " " + (channel+8));
+                  OscMessage message = new OscMessage("/pitch_vel_chan");
+                  message.add(noteOut);
+                  oscP5return.send(message, ableton);
+                link.output(noteOut);
+                noteOut = ("" + note + " " + velocity + " " + channel);
+            }
+            if (velocity == 0 && tracks[channel].cycled){
+                noteOut = ("" + note + " " + velocity + " " + channel);  
+            }
+        }
+        link.output(noteOut);
+        OscMessage message = new OscMessage("/pitch_vel_chan");
+        message.add(noteOut);
+        oscP5return.send(message, ableton);
+        
+    }
+    if (tracks[channel].mute){
+        if (velocity == 0 && !tracks[channel].cycled){
+            noteOut = ("" + note + " " + velocity + " " + (channel+8));
+            link.output(noteOut);
+            OscMessage message = new OscMessage("/pitch_vel_chan");
+            message.add(noteOut);
+            oscP5return.send(message, ableton);
+            noteOut = ("" + note + " " + velocity + " " + channel);
+            OscMessage message2 = new OscMessage("/pitch_vel_chan");
+            message2.add(noteOut);
+            oscP5return.send(message, ableton);
+            link.output(noteOut);
+        }
+    }   
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void mouseDragged(){ // not used
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void mouseReleased(){ // not used
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void mousePressed(){ // not used
+}
+
+
+//-------------------------------------------------------------------------------------------------------------------------------
+
+void keyPressed() { // takes keyboard input
+    if (key == 'c' || key == 'C') {
+        chordSelecter = !chordSelecter;
+        if (!chordSelecter)
+            trSelected = lastTrack;
+        else{
+            lastTrack = trSelected;
+            trSelected = 0;
+            
+        }
+    }
+    
+    if (key == ' ') {
+        if (trSelected != 0){
+            for (int i = 0; i < 16; i++){
+                noteOnArray[i] = false;
+                finishNote(i);
+                displayNoteOnArray[i] = false;
+           }
+    
+           if (trSelected != 0){     
+              for (int i = 24; i < 109; i++)
+                outputToMax(i, 0, trSelected);
+           }
+           tracks[trSelected] = new Track(tracks[trSelected].name, true,  tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false);
+           imgNotes = null;
+        }
+        
+        if (trSelected == 0){
+           for (int i = 0; i < 16; i++){
+               noteOnArray[i] = false;
+               finishNote(i);
+               displayNoteOnArray[i] = false;
+           }
+           heresyMinor = false;
+           heresy7th = false;
+           heresy9th = false;
+           heresy11th = false;
+           heresy13th = false;
+           chordsTemp = new Track(tracks[trSelected].name, true,  tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false);
+           imgNotes = null;
+        }
+    }
+
+     if (key == 'p' || key == 'P') {
+         for (int i = 0; i < 16; i++){
+              for (int ii = 24; ii < 109; ii++)
+                outputToMax(ii, 0, trSelected);
+             noteOnArray[i] = false;
+             displayNoteOnArray[i] = false; 
+         }
+     }
+     
+     if (key == 'd' || key == 'D') {
+         if (trSelected != 0 && trSelected != 1){
+               tracks[trSelected].ducking = !tracks[trSelected].ducking;
+               tracks[trSelected].cycled = false;
+               tracks[trSelected].cycledPosition = currentPulse%tracks[trSelected].loopLength; 
+         }
+     }
+    
+     if (key == 'w' || key == 'W') {
+       
+        trSelected = 0;
+
+        for (int i = 0; i < 16; i++){
+            noteOnArray[i] = false;
+            finishNoteCutOff(i);
+            displayNoteOnArray[i] = false;
+        }
+        heresyMinor = false;
+        heresy7th = false;
+        heresy9th = false;
+        heresy11th = false;
+        heresy13th = false;
+        
+        tracks[trSelected] = new Track(tracks[trSelected].name, true,  tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false);
+        chordsTemp = new Track(tracks[trSelected].name, true,  tracks[trSelected].loopLength, tracks[trSelected].quantize, false, false);
+        imgNotes = null;
+    }
+    
+    if (key == 'q' || key == 'Q'){
+        quantizeValueIn = true;
+        sendToScreen(tracks[trSelected].name + " quantize?");
+    }
+    
+    if (key == 'x' || key == 'X'){
+        clickTrackOn = !clickTrackOn;
+    }
+    
+    if (key == 'e' || key == 'E'){
+        eraseOn = !eraseOn;
+        if (!eraseOn) imgNotes = null;
+    }
+    
+    if (key == 'r' || key == 'R'){
+        imgNotes = null;
+    }
+    
+    if (key == 'l' || key == 'L'){
+        loopLengthValueIn = true;
+        sendToScreen(tracks[trSelected].name + " loop length?");
+    }
+    
+    if (key == 'm' || key == 'M'){
+        if (trSelected != 0){
+            muteValueIn = true;
+            if (!tracks[trSelected].mute)
+                sendToScreen(tracks[trSelected].name + " mute in?");
+            if (tracks[trSelected].mute)
+                sendToScreen(tracks[trSelected].name + " unmute in?");              
+        }
+    }
+
+   
+    if (key == '1') numberKey(1);
+    if (key == '2') numberKey(2);
+    if (key == '3') numberKey(3);
+    if (key == '4') numberKey(4);
+    if (key == '5') numberKey(5);
+    if (key == '6') numberKey(6);
+    if (key == '7') numberKey(7);
+    if (key == '8') numberKey(8);       
+    if (key == '9') numberKey(9);
+    if (key == '0') numberKey(0);
+
+    if (key == CODED) {
+        if (keyCode == UP && trSelected < Track.currentNumberOfTracks-1)
+            trSelected++;
+        if (keyCode == DOWN && trSelected > 1) {
+           trSelected--;
+        } 
+     }
+     
+     if (key == 's' || key == 'S'){
+          for (int i = 0; i < 16; i++){
+              for (int ii = 0; ii < tracks[0].loopLength; ii++){
+                  if (chordsTemp.sequence[i][ii] != null)
+                      tracks[0].sequence[i][ii] = chordsTemp.sequence[i][ii];
+              }
+          }
+     }
+     
+ 
+}
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+void numberKey(int input){ // if a number is enterd, this method works out what to do with it
+    if (quantizeValueIn == true)
+        if (input == 1 || input == 2 || input == 4 || input == 8 || input == 0){
+             tracks[trSelected].quantize = input;
+             quantizeValueIn = false;
+             aniOut = true;
+        }
+         
+    if (loopLengthValueIn == true){
+        if (input >= 1 && input <= 8 ){
+            Track tempTrack = new Track(tracks[trSelected].name, tracks[trSelected].polyphonic, (input * loopLength / 2), tracks[trSelected].quantize, false, false);
+            NoteEvent tempNote;
+            
+            for (int i = 0; i < 16; i++){
+                if (tempTrack.loopLength >= tracks[trSelected].loopLength){
+                    for (int ii = 0; ii < tracks[trSelected].loopLength; ii++){
+                        tempTrack.sequence[i][ii] = tracks[trSelected].sequence[i][ii];
+                    }
+                }else{
+                    for (int ii = 0; ii < tempTrack.loopLength; ii++){
+                        tempTrack.sequence[i][ii] = tracks[trSelected].sequence[i][ii];
+                    }
+                }
+            }
+            tracks[trSelected] = tempTrack;
+            for (int i = 0; i < 16; i++)
+            if (noteOnArray[i] = true){
+                noteOnArray[i] = false;
+                finishNoteCutOff(i);
+                displayNoteOnArray[i] = false;
+            }
+  
+             
+            loopLengthValueIn = false;
+            aniOut = true;
+            if (trSelected ==0){
+                Track tempTrack2 = new Track(chordsTemp.name, chordsTemp.polyphonic, (input * loopLength / 2), chordsTemp.quantize, false, false);
+                NoteEvent tempNote2;
+            
+                for (int i = 0; i < 16; i++){
+                    if (tempTrack2.loopLength >= chordsTemp.loopLength){
+                        for (int ii = 0; ii < chordsTemp.loopLength; ii++){
+                            tempTrack2.sequence[i][ii] = chordsTemp.sequence[i][ii];
+                        }
+                    }else{
+                        for (int ii = 0; ii < tempTrack2.loopLength; ii++){
+                            tempTrack2.sequence[i][ii] = chordsTemp.sequence[i][ii];
+                        }
+                    }  
+                }
+            chordsTemp = tempTrack2;
+            }
+            imgNotes = null;
+        }
+    }
+    
+    if (muteValueIn == true){
+        tracks[trSelected].muteIn = bar + input;
+        muteValueIn = false;
+        tracks[trSelected].muteDone = false;
+        aniOut = true;
+    }
+        
+         
+}
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+void sendToScreen(String name){ // prepares a question for asking the user and turns the question on
+
+      screenQuestion = name;
+      screenAni = 0;
+      haveQuestion = true;
+    
+}
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+void checkCycled(){  // checks whether after ducking or muting all note offs are played.
+    for (int i = 1; i < Track.currentNumberOfTracks; i++)
+        if (tracks[i].cycled == false)
+            if (tracks[i].cycledPosition-1 == currentPulse%tracks[trSelected].loopLength)
+                tracks[i].cycled = true;
+    
+}
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+
+void checkForMutes(){ // looks for mute / unmuted changes in tracks
+    for (int i = 1; i < Track.currentNumberOfTracks; i++)
+        if (tracks[i].muteIn == bar && !tracks[i].muteDone){
+            tracks[i].mute = !tracks[i].mute;
+            tracks[i].muteDone = true;
+            tracks[trSelected].cycled = false;
+            tracks[trSelected].cycledPosition = currentPulse%tracks[trSelected].loopLength; 
+        }
+}
+
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+void writeQuestion(){ // animates screen questions
+  
+  if (screenAni < 10 && !aniOut){
+      screenAni++;
+  }
+  
+  if (screenAni > 0 && aniOut){
+     screenAni--;
+  }
+  
+   if (screenAni == 0){
+      haveQuestion = false;
+      aniOut = false;
+   }
+  
+  fill(255,0,0, screenAni*12);
+  textSize((11-screenAni)*40);
+  text(screenQuestion, (screenAni*50)-200,(100-screenAni*10)+150);
+  
+    
+}
+
+
+//------------------------------------------------------------------------------------------------------------------------------- 
+
+void oscEvent(OscMessage theOscMessage) { // recieves osc messages from openFrameworks
+    if(theOscMessage.checkAddrPattern("/test")==true) {
+        clickTrack = false;
+        String stringValue = theOscMessage.get(0).stringValue();
+        int firstValue = theOscMessage.get(1).intValue(); 
+        int secondValue = theOscMessage.get(2).intValue();
+        int thirdValue = theOscMessage.get(3).intValue(); //velocity
+        int fourthValue = theOscMessage.get(4).intValue(); //channel
+        if (secondValue == 1){
+            noteOnArray[firstValue] = true;
+            writeNote(firstValue, thirdValue, fourthValue);       
+        }
+        else{
+            noteOnArray[firstValue] = false;
+            finishNote(firstValue, fourthValue); 
+        }
+    }
+    if(theOscMessage.checkAddrPattern("/chord")==true) {
+        chordCalc();      
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/NoteEvent.java	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,61 @@
+ class MidiEvent { // the basic super class for all midi events
+  
+    int firstDataByte;
+    int secondDataByte;
+    int channel;
+
+}
+
+//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ class NoteEvent extends MidiEvent{ //  the note event class
+  
+    int notePitch = 60;
+    int[] notePosition = new int[4];
+    int[] noteLength = new int[4];
+    int noteVelocity;  
+    boolean noteIgnore;
+    boolean noteOn;
+    
+    
+    public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, boolean noteOff) {
+        this.notePitch = notePitch;
+        this.channel = channel;
+        this.noteVelocity = 80;     
+        if (noteOff)
+        this.noteVelocity = 0;
+        boolean noteIgnore = false;
+        this.noteOn = true;
+    }
+  
+    public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse) {
+        this(notePitch, channel, bar, beat, fraction, pulse, false);
+    }
+    
+    public NoteEvent(int notePitch, int channel, int veloc, int bar, int beat, int fraction, int pulse) {
+        this.notePitch = notePitch;
+        this.channel = channel;
+        this.noteVelocity = veloc;     
+        boolean noteIgnore = false;
+        this.noteOn = true;
+    }
+
+    
+    public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, int lengthBar, int lengthBeat, int lengthFraction, int lengthPulse) {
+        this.notePitch = notePitch;
+        this.channel = channel;
+        this.noteVelocity = 80;     
+        boolean noteIgnore = false;
+        this.noteOn = true;
+        notePosition[0] = bar;
+        notePosition[1] = beat;
+        notePosition[2] = fraction;
+        notePosition[3] = pulse;
+        noteLength[0] = lengthBar;
+        noteLength[1] = lengthBeat;
+        noteLength[2] = lengthFraction;
+        noteLength[3] = lengthPulse;
+    }
+        
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/Track.java	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,41 @@
+class Track{ // the track class
+  
+    boolean polyphonic;
+    int loopLength;
+    int trackNumber;
+    static int currentNumberOfTracks;
+    boolean selected;
+    NoteEvent[][] sequence;
+    int quantize;
+    boolean forceLegato;
+    String name;
+    boolean ducking;
+    boolean cycled;
+    int cycledPosition;
+    boolean mute;
+    boolean muteDone;
+    int muteIn;
+
+
+    
+    public Track(String name, boolean polyphonic, int loopLength, int quantize, boolean forceLegato, boolean increment){
+      
+        if (polyphonic)
+            this.polyphonic = true;
+        else
+            this.polyphonic = false;
+        this.name = name;
+        this.ducking = false;
+        this.cycled = true;
+        this.forceLegato = forceLegato;
+        this.quantize = quantize;
+        this.loopLength = loopLength;
+        if (increment) this.trackNumber = currentNumberOfTracks++;
+        this.selected = false;
+        this.mute = false;
+        this.muteIn = 0;
+        sequence = new NoteEvent[16][loopLength];
+     
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/VirtualPlayingArray.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,31 @@
+class VPArray{ // the virtual playing array for Heresy AI to play with
+  
+    VPNote[] VPArrayNotes;
+    
+    public VPArray(){
+        VPArrayNotes = new VPNote[16];
+        for (int i = 0; i < 16; i++)
+          VPArrayNotes[i] = new VPNote();
+    }
+}
+
+class VPNote{
+  
+    boolean played;
+    boolean VPNoteOn;
+    boolean done;
+    int extension;
+    int VPNotePitch;
+    int VPNoteVelocity;
+    
+    public VPNote(){
+       VPNoteOn = false;
+       played = true;
+        extension = 0;
+        VPNotePitch = 0;
+        VPNoteVelocity = 0;
+    }
+}
+
+ 
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/chord_changer.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,398 @@
+
+void chordCalc(){
+    barCounter++;
+    if (barCounter % 4 == 0 || ((currentChord == 1 || currentChord == 5 || currentChord == 7) && barCounter % 4 == 3)){
+        tonicNeeded = true;
+        print(" tonic needed " + (barCounter % 4));
+     }
+     else tonicNeeded = false;
+     chooseChord();
+}
+
+void chooseChord(){
+
+    int i = 0;
+    for (; i < crneeded; i++){
+        if (chordChoicesArray[i].chordNote == currentChord && chordChoicesArray[i].minor == heresyMinor)
+            break;
+    }
+    if (currentChord == 1 && heresyDom)
+        i = 16;
+    if (tonicNeeded && i != 24){
+        int gotOne = -1;
+        int gotTwo = -1;
+        if (chordChoicesArray[i].optionArray[0].chordOption == 0 && chordChoicesArray[i].optionArray[1].chordOption == 0 && int(random(2)) == 0)
+            chosenChord (i, chordChoicesArray[i].optionArray[1].chordOption);
+        else if 
+            (chordChoicesArray[i].optionArray[0].chordOption == 0 && chordChoicesArray[i].optionArray[1].chordOption != 0)
+            chosenChord (i, chordChoicesArray[i].optionArray[0].chordOption);
+        else
+            chosenChord (i, int(random(chordChoicesArray[i].slots)));
+    }
+    else if (i != 24){
+        chosenChord(i, int(random(chordChoicesArray[i].slots))); 
+    }else{
+        currentChord = lastChordChange;
+        heresyMinor = lastMinor;
+    }
+    println("   chord selected : " + currentChord + " minor:" + heresyMinor);
+}
+
+void chosenChord(int p, int p2){
+    lastChordChange = currentChord;
+    lastMinor = heresyMinor;
+ //   println("p: " + p + "  p2 : " + p2);
+    currentChord = chordChoicesArray[p].optionArray[p2].chordOption;
+    heresyMinor = chordChoicesArray[p].optionArray[p2].minor;
+    if (int(random(4)) == 0 && chordChoicesArray[p].optionArray[p2].h7th)
+        heresy7th = true;
+    else
+        heresy7th = false;
+    if (int(random(4)) == 0 && chordChoicesArray[p].optionArray[p2].h9th && heresy7th)
+        heresy9th = true;
+    else
+        heresy9th = false;       
+    if (int(random(4)) == 0 && chordChoicesArray[p].optionArray[p2].h11th && heresy9th)
+        heresy11th = true;
+    else
+        heresy11th = false;
+
+
+}   
+
+
+
+class chordChoices{
+    int chordNote;
+    boolean minor;
+    ChordChoice[] optionArray;
+    int slots;
+    
+    public chordChoices(int chordNote, boolean minor, int slotsNeeded){
+        this.chordNote = chordNote;
+        this.minor = minor;
+        optionArray = new ChordChoice[slotsNeeded];
+        slots = slotsNeeded;
+    }
+}
+
+class ChordChoice{
+    int chordOption;
+    boolean minor, h7th, h9th, h11th, h13th, dom;
+    
+    public ChordChoice(int chordOption, boolean minor, boolean dom, boolean h7th, boolean h9th, boolean h11th, boolean h13th){
+        this.chordOption = chordOption;
+        this.minor = minor;
+        this.dom = dom;
+        this.h7th = h7th;
+        this.h9th = h9th;
+        this.h11th = h11th;
+        this.h13th = h13th;       
+    }
+}
+
+//void stuff(){
+chordChoices[] chordChoicesArray = new chordChoices[crneeded];
+
+void markovStuff(){
+chordChoicesArray[0] = new chordChoices(0, false, 13);
+chordChoicesArray[0].optionArray[0] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[0].optionArray[1] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[0].optionArray[2] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[0].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[0].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[0].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[0].optionArray[6] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[0].optionArray[7] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[0].optionArray[8] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[0].optionArray[9] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[0].optionArray[10] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[0].optionArray[11] = new ChordChoice(10, false, true, true, true, true, true);
+chordChoicesArray[0].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true);
+
+chordChoicesArray[1] = new chordChoices(0, true, 14);
+chordChoicesArray[1].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[1].optionArray[1] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[1].optionArray[2] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[3] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[1].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[6] = new ChordChoice(6, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[1].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[1].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[11] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[1].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true);
+chordChoicesArray[1].optionArray[13] = new ChordChoice(11, false, false, true, true, true, true);
+
+chordChoicesArray[2] = new chordChoices(2, false, 9);
+chordChoicesArray[2].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[2].optionArray[1] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[2].optionArray[2] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[2].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[2].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[2].optionArray[5] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[2].optionArray[6] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[2].optionArray[7] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[2].optionArray[8] = new ChordChoice(10, false, false, true, true, true, true);
+
+chordChoicesArray[3] = new chordChoices(2, true, 13);
+chordChoicesArray[3].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[3].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[3].optionArray[2] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[3].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[3].optionArray[4] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[3].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[3].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[3].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[3].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[3].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[3].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[3].optionArray[11] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[3].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true);
+
+chordChoicesArray[4] = new chordChoices(4, false, 4);
+chordChoicesArray[4].optionArray[0] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[4].optionArray[1] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[4].optionArray[2] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[4].optionArray[3] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[5] = new chordChoices(4, true, 13);
+chordChoicesArray[5].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[5].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[5].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[5].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[5].optionArray[4] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[5].optionArray[5] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[5].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[5].optionArray[7] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[5].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[5].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[5].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[5].optionArray[11] = new ChordChoice(11, false, false, true, true, true, true);
+chordChoicesArray[5].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[6] = new chordChoices(5, false, 14);
+chordChoicesArray[6].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[6].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[2] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[3] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[4] = new ChordChoice(4, false, false, true, true, true, true);
+chordChoicesArray[6].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[6] = new ChordChoice(6, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[6].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[9] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[6].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[11] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[6].optionArray[12] = new ChordChoice(10, true, false, true, true, true, true);
+chordChoicesArray[6].optionArray[13] = new ChordChoice(10, false, false, true, true, true, true);
+
+chordChoicesArray[7] = new chordChoices(5, true, 15);
+chordChoicesArray[7].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[7].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[7].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[7].optionArray[4] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[6] = new ChordChoice(4, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[7] = new ChordChoice(6, true, false, true, true, true, true);
+chordChoicesArray[7].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[7].optionArray[9] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[7].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[13] = new ChordChoice(11, false, false, true, true, true, true);
+chordChoicesArray[7].optionArray[14] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[8] = new chordChoices(7, true, 14);
+chordChoicesArray[8].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[8].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[8].optionArray[3] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[4] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[8].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[6] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[8].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[8].optionArray[9] = new ChordChoice(6, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[8].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[8].optionArray[13] = new ChordChoice(10, true, false, true, true, true, true);
+
+chordChoicesArray[9] = new chordChoices(7, false, 10);
+chordChoicesArray[9].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[9].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[9].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[9].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[9].optionArray[4] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[9].optionArray[5] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[9].optionArray[6] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[9].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[9].optionArray[8] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[9].optionArray[9] = new ChordChoice(9, true, false, true, true, true, true);
+
+chordChoicesArray[10] = new chordChoices(9, true, 13);
+chordChoicesArray[10].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[10].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[10].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[10].optionArray[3] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[10].optionArray[4] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[10].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[10].optionArray[6] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[10].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[10].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[10].optionArray[9] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[10].optionArray[10] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[10].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[10].optionArray[12] = new ChordChoice(10, false, false, true, true, true, true);
+
+chordChoicesArray[11] = new chordChoices(11, false, 6);
+chordChoicesArray[11].optionArray[0] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[11].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[11].optionArray[2] = new ChordChoice(1, true, false, true, true, true, true);
+chordChoicesArray[11].optionArray[3] = new ChordChoice(1, false, false, true, true, true, true);
+chordChoicesArray[11].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[11].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true);
+
+chordChoicesArray[12] = new chordChoices(11, true, 5);
+chordChoicesArray[12].optionArray[0] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[12].optionArray[1] = new ChordChoice(2, true, false, true, true, true, true);
+chordChoicesArray[12].optionArray[2] = new ChordChoice(5, false, true, true, true, true, true);
+chordChoicesArray[12].optionArray[3] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[12].optionArray[4] = new ChordChoice(8, false, false, true, true, true, true);
+
+chordChoicesArray[13] = new chordChoices(1, false, 2);
+chordChoicesArray[13].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[13].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+
+chordChoicesArray[14] = new chordChoices(1, true, 2);
+chordChoicesArray[14].optionArray[0] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[14].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+
+chordChoicesArray[15] = new chordChoices(3, false, 12);
+chordChoicesArray[15].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[15].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[15].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[15].optionArray[3] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[15].optionArray[4] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[15].optionArray[5] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[15].optionArray[6] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[15].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[15].optionArray[8] = new ChordChoice(10, true, false, true, true, true, true);
+chordChoicesArray[15].optionArray[9] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[15].optionArray[10] = new ChordChoice(11, false, false, true, true, true, true);
+chordChoicesArray[15].optionArray[11] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[16] = new chordChoices(111, false, 2);
+chordChoicesArray[16].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[16].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+
+chordChoicesArray[17] = new chordChoices(6, false, 10);
+chordChoicesArray[17].optionArray[0] = new ChordChoice(1, false, false, true, true, true, true);
+chordChoicesArray[17].optionArray[1] = new ChordChoice(1, true, false, true, true, true, true);
+chordChoicesArray[17].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[17].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[17].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[17].optionArray[5] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[17].optionArray[6] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[17].optionArray[7] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[17].optionArray[8] = new ChordChoice(10, true, false, true, true, true, true);
+chordChoicesArray[17].optionArray[9] = new ChordChoice(10, false, false, true, true, true, true);
+
+chordChoicesArray[18] = new chordChoices(8, false, 17);
+chordChoicesArray[18].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[18].optionArray[3] = new ChordChoice(1, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[4] = new ChordChoice(1, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[5] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[6] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[7] = new ChordChoice(4, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[8] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[9] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[10] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[11] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[12] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[13] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[18].optionArray[14] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[15] = new ChordChoice(11, false, false, true, true, true, true);
+chordChoicesArray[18].optionArray[16] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[19] = new chordChoices(8, true, 10);
+chordChoicesArray[19].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[19].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[19].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[19].optionArray[3] = new ChordChoice(1, false, false, true, true, true, true);
+chordChoicesArray[19].optionArray[4] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[19].optionArray[5] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[19].optionArray[6] = new ChordChoice(4, false, false, true, true, true, true);
+chordChoicesArray[19].optionArray[7] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[19].optionArray[8] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[19].optionArray[9] = new ChordChoice(5, false, false, true, true, true, true);
+
+chordChoicesArray[20] = new chordChoices(3, true, 19);
+chordChoicesArray[20].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[20].optionArray[3] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[4] = new ChordChoice(4, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[5] = new ChordChoice(4, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[6] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[7] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[8] = new ChordChoice(6, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[9] = new ChordChoice(6, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[10] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[12] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[13] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[14] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[15] = new ChordChoice(10, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[16] = new ChordChoice(10, true, false, true, true, true, true);
+chordChoicesArray[20].optionArray[17] = new ChordChoice(11, false, false, true, true, true, true);
+chordChoicesArray[20].optionArray[18] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[21] = new chordChoices(6, true, 9);
+chordChoicesArray[21].optionArray[0] = new ChordChoice(1, false, false, true, true, true, true);
+chordChoicesArray[21].optionArray[1] = new ChordChoice(1, true, false, true, true, true, true);
+chordChoicesArray[21].optionArray[2] = new ChordChoice(2, false, false, true, true, true, true);
+chordChoicesArray[21].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[21].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[21].optionArray[5] = new ChordChoice(4, false, false, true, true, true, true);
+chordChoicesArray[21].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[21].optionArray[7] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[21].optionArray[8] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[22] = new chordChoices(10, false, 13);
+chordChoicesArray[22].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[22].optionArray[1] = new ChordChoice(0, true, false, true, true, true, true);
+chordChoicesArray[22].optionArray[2] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[22].optionArray[3] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[22].optionArray[4] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[22].optionArray[5] = new ChordChoice(5, true, false, true, true, true, true);
+chordChoicesArray[22].optionArray[6] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[22].optionArray[7] = new ChordChoice(6, false, false, true, true, true, true);
+chordChoicesArray[22].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[22].optionArray[9] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[22].optionArray[10] = new ChordChoice(8, true, false, true, true, true, true);
+chordChoicesArray[22].optionArray[11] = new ChordChoice(8, false, false, true, true, true, true);
+chordChoicesArray[22].optionArray[12] = new ChordChoice(11, true, false, true, true, true, true);
+
+chordChoicesArray[23] = new chordChoices(10, true, 12);
+chordChoicesArray[23].optionArray[0] = new ChordChoice(0, false, false, true, true, true, true);
+chordChoicesArray[23].optionArray[1] = new ChordChoice(1, false, true, true, true, true, true);
+chordChoicesArray[23].optionArray[2] = new ChordChoice(3, false, false, true, true, true, true);
+chordChoicesArray[23].optionArray[3] = new ChordChoice(3, true, false, true, true, true, true);
+chordChoicesArray[23].optionArray[4] = new ChordChoice(5, false, false, true, true, true, true);
+chordChoicesArray[23].optionArray[5] = new ChordChoice(6, true, false, true, true, true, true);
+chordChoicesArray[23].optionArray[6] = new ChordChoice(6, false, false, true, true, true, true);
+chordChoicesArray[23].optionArray[7] = new ChordChoice(7, false, false, true, true, true, true);
+chordChoicesArray[23].optionArray[8] = new ChordChoice(7, true, false, true, true, true, true);
+chordChoicesArray[23].optionArray[9] = new ChordChoice(9, false, false, true, true, true, true);
+chordChoicesArray[23].optionArray[10] = new ChordChoice(9, true, false, true, true, true, true);
+chordChoicesArray[23].optionArray[11] = new ChordChoice(11, true, false, true, true, true, true);
+
+
+}
Binary file HeresyBigBangDone/code/maxlink.jar has changed
Binary file HeresyBigBangDone/code/oscP5.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeresyBigBangDone/sequences.pde	Fri Feb 25 13:48:11 2011 +0000
@@ -0,0 +1,70 @@
+void loadSequences(){
+  
+    ArrayList<NoteEvent> sequenceBass = new ArrayList<NoteEvent>();
+    sequenceBass.add(new NoteEvent(15, 2,   1,  1,  1,  1,    0,  3,  3,  0));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  1,  2,  1,    0,  0,  0,  5));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  2,  3,  1,    0,  0,  0,  5));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  2,  4,  1,    0,  0,  0,  5));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  3,  2,  1,    0,  0,  0,  5));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  3,  3,  1,    0,  0,  0,  5));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  4,  1,  1,    0,  0,  0,  5));
+ // sequenceBass.add(new NoteEvent(15, 2,   1,  4,  2,  1,    0,  0,  0,  5));
+    seedSequencer(sequenceBass, 2);
+    
+    ArrayList<NoteEvent> sequencePizz = new ArrayList<NoteEvent>();
+    sequencePizz.add(new NoteEvent(13, 2,   1,  1,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(12, 2,   1,  1,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(11, 2,   1,  1,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(10, 2,   1,  1,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(9,  2,   1,  1,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(8,  2,   1,  1,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(7,  2,   1,  1,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(6,  2,   1,  1,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(0,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(1,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(2,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(3,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(4,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(8,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(7,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(6,  2,   1,  2,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(13, 2,   1,  3,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(12, 2,   1,  3,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(11, 2,   1,  3,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(10, 2,   1,  3,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(9,  2,   1,  3,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(8,  2,   1,  3,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(7,  2,   1,  3,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(6,  2,   1,  3,  3,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(0,  2,   1,  4,  1,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(1,  2,   1,  4,  1,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(2,  2,   1,  4,  1,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(3,  2,   1,  4,  1,  1,    0,  0,  1,  0));
+    sequencePizz.add(new NoteEvent(4,  2,   1,  4,  1,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(8,  2,   1,  4,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(7,  2,   1,  4,  3,  1,    0,  0,  1,  0));
+//  sequencePizz.add(new NoteEvent(6,  2,   1,  4,  3,  1,    0,  0,  1,  0));
+    seedSequencer(sequencePizz, 3);
+/*    
+    ArrayList<NoteEvent> sequenceStrings = new ArrayList<NoteEvent>();
+    sequenceStrings.add(new NoteEvent(13, 2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(12, 2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(11, 2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(10, 2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(9,  2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(8,  2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(7,  2,   1,  1,  1,  1,    0,  1,  3,  0));
+    sequenceStrings.add(new NoteEvent(6,  2,   1,  1,  1,  1,    0,  1,  3,  0));
+    seedSequencer(sequenceStrings, 4);
+*/
+    
+}
+
+void seedSequencer(ArrayList<NoteEvent> sIn, int track){
+    for (int i = 0; i < sIn.size(); i++){
+      NoteEvent s = sIn.get(i);
+  //  println("info stuff : " + s[i].notePitch);
+        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);
+        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);
+    }
+}
--- a/README	Fri Feb 18 10:17:45 2011 +0000
+++ b/README	Fri Feb 25 13:48:11 2011 +0000
@@ -1,65 +1,9 @@
+from grid_mapper import *
+# set IP address for Joe's computer in tuple joe
+# start the server
+start()
 
---------------------------------------------------------------------
-Install instructions for OpenNI
---------------------------------------------------------------------
+stop()
 
-Install notes:
-	1) Install unstable OpenNI (http://www.openni.org/downloadfiles/openni-binaries/20-latest-unstable)
-	   On Linux/Mac please do: ./sudo install.sh
-	2) Install Sensor (this version...)
-	   On Linux/Mac please do: ./sudo install.sh
-	3) Install unstable NITE (http://www.openni.org/downloadfiles/openni-compliant-middleware-binaries/33-latest-unstable)
-	   On Linux/Mac please do: ./sudo install.sh
-	   Use this license when asked during the installation: 0KOIk2JeIBYClPWVnMoRKn5cdY4=
-	4) Test #1: Run the NiViewer sample to make sure depth & image streams are working.
-	5) Test #2: Run the OpenNI/NiUserTracker sample play with the skeleton. Don't forget to start with the calibration pose! (Explained in the PDFs)
-	6) Test #3: Try the NITE/Sample-PointViewer sample for the hand tracking demo.
-
-	For Mac/Linux, you will need to install the latest LibUSB.
-	Linux:
-		1) Run: sudo apt-get install libusb-1.0-0-dev
-		2) Run: sudo apt-get install freeglut3-dev
-	MaxOSX:
-		1) Intall MacPorts from: http://distfiles.macports.org/MacPorts/MacPorts-1.9.2-10.6-SnowLeopard.dmg
-		2) Run: sudo port install libtool
-		3) Run: sudo port install libusb-devel +universal
-		   Note: Do not forget the +universal, it's very important!!
-		   If you're previously already installed libusb-devel then use "sudo port uninstall libusb-devel" and reinstall it again with the +universal flag.
-		
-		
-		Nutshell Mac OpenNi/Kinect install for DUMMIES: 
-		This job is going to take ONE DAY. It will be SLOW. Your computer is 
-		going to run a long time. 
-		You need to be running OS X 10.6, Xcode installed, there may be some 
-		recent-hardware constraint. 
-		You will install Git, Mac Ports libtool, libusb-devel, OpenNi, 
-		SensorKinect, and Nite in that order. 
-
-		- Install Git from http://git-scm.com/, use it to download 
-		SensorKinect from github: 
-		- run "git clone git://github.com/avin2/SensorKinect.git" 
-		- Get and *read* the README in SensorKinect. Keep that README open, it 
-		explains what is happening here. 
-		- Do a clean install of Mac Ports. Uninstall an existing Macports 
-		first. 
-		- run "sudo port install libtool +universal" 
-		- run "sudo port install libusb-devel +universal" 
-		- download OpenNi unstable:  http://www.openni.org/downloadfiles/openni-binaries/20-latest-unstable 
-		- run as sudo the OpenNi unstable binaries install.sh script 
-		- run as sudo the SensorKinect install.sh script 
-		- download Nite unstable: 
-		http://www.openni.org/downloadfiles/openni-compliant-middleware-binar... 
-		- edit the three Nite DATA XML files to 640x480 
-		- run as sudo the Nite install.sh script. License key is 
-		"0KOIk2JeIBYClPWVnMoRKn5cdY4=" 
-
-		Bravo! You should be done installing! As a reward, you now get to 
-		test: 
-		- go to the Nite tree, and in Samples/bin you have a bunch of binaries 
-		that just got built. 
-		- plug in the Kinect power supply, then the USB plug of the Kinect 
-		bar. Run the Box sample.
-		
-
-
-
+# if you quit the interpreter without stopping, 
+# need to find and kill the process
Binary file of/frabk.ttf has changed
--- a/of/testApp.h	Fri Feb 18 10:17:45 2011 +0000
+++ b/of/testApp.h	Fri Feb 25 13:48:11 2011 +0000
@@ -20,7 +20,7 @@
 
 	void getCoordinates(int userID);
 	void sendDataViaOSC(int userID);
-	
+
 		void keyPressed  (int key);
 		void keyReleased(int key);
 		void mouseMoved(int x, int y );
@@ -37,18 +37,13 @@
 		ofImage anubis;
 		bool drawIt;
 
-		float torso[6][3];//x,y,and z of the head
+
+	float torso[6][3];//x,y,and z of the head
 	bool userPresent[6];
 	
 	ofTrueTypeFont franklinBook;
 	string outputString;
 	ofxOscSender sender;
 	
-
 };
-
-
-
-
-
 #endif
--- a/tim_grid_mapper/grid_mapper.py	Fri Feb 18 10:17:45 2011 +0000
+++ b/tim_grid_mapper/grid_mapper.py	Fri Feb 25 13:48:11 2011 +0000
@@ -1,4 +1,5 @@
-'''
+#! /usr/bin/python
+'''
 grid_mapper.py - maintained by Tim.
 
 This module implements a mapping from person positions (id,x,y,z) to generate 
@@ -10,6 +11,7 @@
 from OSC import ThreadingOSCServer, OSCClient, OSCMessage, OSCClientError
 from threading import Thread
 from time import sleep
+import pdb
 
 #### PUBLIC OPTIONS ####
 num_channels = 3 # number of instruments (and max number of people who can 
@@ -17,8 +19,8 @@
 
 #### OSC OPTIONS - THESE NEED TO BE SET MANUALLY ####
 my_port = 12344 # to receive OSC messages
-joe     = ('localhost', "THIS_MUST_BE_SET")
-ableton = ('localhost', "THIS_MUST_BE_SET")
+joe     = ('localhost', 12345)
+ableton = ('localhost', 12346)
 
 ### Constants for grid mapping:
 # The range of values that the input coordinates and output values may take:
@@ -30,6 +32,7 @@
 	'pitch'	: 0,
 	'cc1'   : 0,
 	'cc2'   : 0,
+	'velocity' : 0,
 }
 MAX = {
 	'x'     : 1.,
@@ -38,6 +41,7 @@
 	'pitch' : 15,
 	'cc1'   : 127,
 	'cc2'   : 127,
+	'velocity' : 127,
 }
 
 
@@ -49,7 +53,19 @@
 currently_playing = [None] * num_channels
 
 # mapping from personId to time of last update
-last_update_times = {} 
+# ((not yet implemented))
+#last_update_times = {}
+
+# mapping from (channel, CC_number) to last CC value sent:
+last_value_sent = {
+	(1, 1) : 0,
+	(1, 2) : 0,
+	(2, 1) : 0,
+	(2, 2) : 0,
+	(3, 1) : 0,
+	(3, 2) : 0,
+}
+	
 
 # OSC OBJECTS
 server = None # Initialised when start() is run
@@ -64,10 +80,22 @@
 def send_to_joe(data, address='/test'):
 	'''Sends `data` to Joe directly as an OSC message.
 	'''
-	message = OSCMesssage(address)
+	message = OSCMessage(address)
 	message.extend(data)
 	client.sendto(message, joe)
-	print_d('==OSC Output to Joe %s:==\n    %s' % (joe, data))
+	print_d('\n==OSC Output "%s" to Joe %s:==\n    %s' % (address, joe, data))
+
+
+def send_to_ableton(data, address='/cc'):
+	'''Sends `data` to Ableton (via Max) as an OSC message.
+	'''
+	#pdb.set_trace()
+	message = OSCMessage(address)
+	message.extend(data)
+	client.sendto(message, ableton)
+	print('\n==OSC Output "%s" to Ableton %s:==\n    %s' % (address, ableton, data))
+	
+
 
 def flush(channel):
 	'''Sends note off messages for whatever note is currently playing on 
@@ -79,11 +107,12 @@
 		send_to_joe([
 			'Turn off note %i on channel %i' % (pitch, channel), 
 			    # first string is ignored
-			pitch,       # pitch to turn off
-			0,                                # 0 to turn note off
-			127,                # doesn't matter for note-off (but never send 0)
-			channel,
+			int(pitch),       # pitch to turn off
+			0,                # 0 to turn note off
+			127,              # doesn't matter for note-off (but never send 0)
+			int(channel),
 		])
+	currently_playing[channel] = None
 
 
 def person_handler(address, tags, data, client_address):
@@ -91,7 +120,16 @@
 	
 	`data` should be in form [person_id, x, y, z]
 	'''
-	pitch, velocity, channel, cc1, cc2 = grid_map(data)
+	pitch, velocity, channel, cc1, cc2 = grid_map(*data)
+	
+	cc1, cc2 = int(round(cc1)), int(round(cc2))
+	if cc1 != last_value_sent[(channel, 1)]:
+		send_to_ableton([channel, 1, cc1], '/cc')
+		last_value_sent[(channel, 1)] = cc1
+	if cc2 != last_value_sent[(channel, 2)]:
+		send_to_ableton([channel, 2, cc2], '/cc')
+		last_value_sent[(channel, 2)] = cc2		
+
 	
 	## Format data for Joe - done using Specification.txt on 2011-02-15
 	
@@ -109,12 +147,14 @@
 		send_to_joe([
 			'Turn on note %i on channel %i' % (pitch, channel),
 				# first value is string which is ignored
-			pitch,    
-			1,        # 1 to turn note on
-			velocity, 
-			channel
+			int(pitch),    
+			1,               # 1 to turn note on
+			int(velocity), 
+			int(channel)
 		])
-	
+		currently_playing[channel] = pitch
+
+
 
 
 
@@ -141,7 +181,7 @@
 	                          MIN['x'],     MAX['x'],
 	                          MIN['cc1'], MAX['cc1'])
 	        )
-	cc2 = round(interpolate(x, 
+	cc2 = round(interpolate(y, 
 	                          MIN['y'],     MAX['y'],
 	                          MIN['cc2'], MAX['cc2'])
 	        )