{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 6, "minor" : 0, "revision" : 8 } , "rect" : [ 648.0, 162.0, 838.0, 588.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 0, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 0, "statusbarvisible" : 2, "toolbarvisible" : 1, "boxanimatetime" : 200, "imprint" : 0, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "description" : "", "digest" : "", "tags" : "", "boxes" : [ { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-114", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 447.5, 120.0, 32.5, 18.0 ], "presentation_rect" : [ 455.0, 118.0, 0.0, 0.0 ], "text" : "17" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-113", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 428.0, 435.0, 60.0, 20.0 ], "text" : "Counter" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-109", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 401.25, 521.0, 60.0, 20.0 ], "text" : "Col, Row" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-107", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 317.5, 435.0, 32.5, 18.0 ], "text" : "11" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-105", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 382.5, 435.0, 32.5, 18.0 ], "presentation_rect" : [ 385.0, 375.0, 0.0, 0.0 ], "text" : "66" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-104", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 285.0, 435.0, 32.5, 18.0 ], "text" : "6" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-102", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 341.25, 521.0, 50.0, 20.0 ], "presentation_rect" : [ 343.0, 510.0, 0.0, 0.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-101", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 285.0, 521.0, 50.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-98", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 341.25, 495.0, 32.5, 20.0 ], "text" : "/ 11" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-99", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 285.0, 495.0, 37.0, 20.0 ], "text" : "% 11" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-97", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "int" ], "patching_rect" : [ 285.0, 465.0, 57.0, 20.0 ], "text" : "trigger i i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-92", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 350.0, 435.0, 32.5, 18.0 ], "text" : "63" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-90", "linecount" : 6, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 285.0, 330.0, 225.0, 87.0 ], "text" : "For each value that comes out of uzi's counting outlet, we want to take both the div and mod. This gives us the column and row number for any counter value. The patch below shows some examples for 11 elements per row." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-88", "linecount" : 8, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 285.0, 195.0, 225.0, 114.0 ], "text" : "When we bang the patch, it first sends a message clearing the matrixctrl object. We want to start counting with zero, which is what the second argument to the uzi object does. Uzi's first argument sets the default number of elements to 10 (but this is overridden by our choice above)." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-86", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 540.0, 375.0, 240.0, 74.0 ], "text" : "One of matrixctrl's modes turns off all of the cells in a column except one. We don't want this behaviour, so if your patch seems not to work, try sending the \"one/column 0\" message to matrixctrl." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-84", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 660.0, 120.0, 82.0, 18.0 ], "text" : "one/column 0" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-81", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 191.75, 465.0, 34.0, 20.0 ], "text" : "print" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-78", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 64.0, 465.0, 113.0, 20.0 ], "text" : "prepend \\; matrixctrl" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-77", "linecount" : 2, "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 30.0, 506.0, 147.0, 31.0 ], "text" : ";\rmatrixctrl 8 7 1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-75", "linecount" : 2, "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 75.0, 195.0, 89.0, 31.0 ], "text" : ";\rmatrixctrl clear" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-70", "maxclass" : "newobj", "numinlets" : 3, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 64.0, 420.0, 66.0, 20.0 ], "text" : "pack 0 0 1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-69", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 150.0, 375.0, 32.5, 20.0 ], "text" : "/" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-68", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "int" ], "patching_rect" : [ 64.0, 375.0, 32.5, 20.0 ], "text" : "%" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-65", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "int" ], "patching_rect" : [ 150.0, 315.0, 57.0, 20.0 ], "presentation_rect" : [ 145.5, 264.0, 0.0, 0.0 ], "text" : "trigger i i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-64", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 3, "outlettype" : [ "bang", "int", "int" ], "patching_rect" : [ 40.0, 315.0, 67.0, 20.0 ], "text" : "trigger b i i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-60", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 105.0, 270.0, 151.0, 20.0 ], "text" : "receive elements_per_row" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-53", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 75.0, 240.0, 131.0, 20.0 ], "text" : "receive num_elements" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-52", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 3, "outlettype" : [ "bang", "bang", "int" ], "patching_rect" : [ 30.0, 270.0, 53.0, 20.0 ], "text" : "uzi 10 0" } } , { "box" : { "id" : "obj-49", "maxclass" : "button", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], "patching_rect" : [ 30.0, 195.0, 20.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-47", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 415.0, 120.0, 32.5, 18.0 ], "text" : "13" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-45", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 382.5, 120.0, 32.5, 18.0 ], "text" : "11" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-43", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 285.0, 120.0, 32.5, 18.0 ], "text" : "8" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-41", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 350.0, 120.0, 32.5, 18.0 ], "text" : "10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-39", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 317.5, 120.0, 32.5, 18.0 ], "text" : "9" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-37", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 285.0, 150.0, 139.0, 20.0 ], "text" : "send elements_per_row" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-36", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 62.5, 120.0, 32.5, 18.0 ], "presentation_rect" : [ 67.5, 117.0, 0.0, 0.0 ], "text" : "13" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-35", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 30.0, 120.0, 32.5, 18.0 ], "text" : "10" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-33", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 225.0, 120.0, 32.5, 18.0 ], "text" : "100" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-31", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 160.0, 120.0, 32.5, 18.0 ], "text" : "66" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-29", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 192.5, 120.0, 32.5, 18.0 ], "text" : "99" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-27", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 127.5, 120.0, 32.5, 18.0 ], "text" : "47" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-25", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 95.0, 120.0, 32.5, 18.0 ], "text" : "40" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-20", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 150.0, 119.0, 20.0 ], "text" : "send num_elements" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-9", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 90.0, 480.0, 20.0 ], "text" : "We start by choosing the total number of elements and the number of elements per row" } } , { "box" : { "columns" : 20, "id" : "obj-4", "maxclass" : "matrixctrl", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "list", "list" ], "parameter_enable" : 0, "patching_rect" : [ 540.0, 165.0, 240.0, 195.0 ], "rows" : 15 } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-1", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 540.0, 120.0, 101.0, 20.0 ], "text" : "receive matrixctrl" } } , { "box" : { "bubble" : 1, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-2", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 15.0, 315.0, 51.0 ], "text" : "Patch 034. Processing Grids with Div and Mod\nWilliam J Turkel\nhttp://williamjturkel.net/code/#programming" } } , { "box" : { "bgcolor" : [ 1.0, 1.0, 1.0, 0.0 ], "border" : 1, "id" : "obj-3", "maxclass" : "panel", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 77.5, 810.0, 495.0 ], "rounded" : 20 } } ], "lines" : [ { "patchline" : { "destination" : [ "obj-4", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-1", 0 ] } } , { "patchline" : { "destination" : [ "obj-97", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-104", 0 ] } } , { "patchline" : { "destination" : [ "obj-97", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-105", 0 ] } } , { "patchline" : { "destination" : [ "obj-97", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-107", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-114", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-25", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-27", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-29", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-31", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-33", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-35", 0 ] } } , { "patchline" : { "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-36", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-39", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-41", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-43", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-45", 0 ] } } , { "patchline" : { "destination" : [ "obj-37", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-47", 0 ] } } , { "patchline" : { "destination" : [ "obj-52", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-49", 0 ] } } , { "patchline" : { "destination" : [ "obj-75", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-49", 0 ] } } , { "patchline" : { "destination" : [ "obj-64", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-52", 2 ] } } , { "patchline" : { "destination" : [ "obj-52", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-53", 0 ] } } , { "patchline" : { "destination" : [ "obj-65", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-60", 0 ] } } , { "patchline" : { "destination" : [ "obj-68", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-64", 1 ] } } , { "patchline" : { "destination" : [ "obj-69", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-64", 2 ] } } , { "patchline" : { "destination" : [ "obj-77", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-64", 0 ] } } , { "patchline" : { "destination" : [ "obj-68", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-65", 0 ] } } , { "patchline" : { "destination" : [ "obj-69", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-65", 1 ] } } , { "patchline" : { "destination" : [ "obj-70", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-68", 0 ] } } , { "patchline" : { "destination" : [ "obj-70", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-69", 0 ] } } , { "patchline" : { "destination" : [ "obj-78", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-70", 0 ] } } , { "patchline" : { "destination" : [ "obj-81", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-70", 0 ] } } , { "patchline" : { "destination" : [ "obj-77", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-78", 0 ] } } , { "patchline" : { "destination" : [ "obj-4", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-84", 0 ] } } , { "patchline" : { "destination" : [ "obj-97", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-92", 0 ] } } , { "patchline" : { "destination" : [ "obj-98", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-97", 1 ] } } , { "patchline" : { "destination" : [ "obj-99", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-97", 0 ] } } , { "patchline" : { "destination" : [ "obj-102", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-98", 0 ] } } , { "patchline" : { "destination" : [ "obj-101", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-99", 0 ] } } ], "dependency_cache" : [ ] } }