{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 6, "minor" : 0, "revision" : 8 } , "rect" : [ 676.0, 227.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-85", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 133.0, 448.5, 34.0, 20.0 ], "text" : "print" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-84", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 180.0, 311.0, 315.0, 74.0 ], "text" : "The trigger object sends the current index value of the outer uzi object to pack, then bangs the inner uzi. The inner uzi fires as many times as it is supposed to. Meanwhile, the pack object builds messages to send to matrixctrl. Each is banged by the inner uzi to send it." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-82", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 180.0, 225.0, 315.0, 74.0 ], "text" : "One way to process a grid in Max is to use a nested pair of uzi objects. Uzi's rightmost outlet sends an index number for each bang. The first time uzi bangs, it sends a 1 out the rightmost outlet then a bang out the leftmost. The second time it sends a 2, then bangs, and so on." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-80", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 525.0, 435.0, 270.0, 60.0 ], "text" : "If we wanted an uzi index to count from 0, we could just subtract 1 from the value output from its rightmost outlet. Try modifying the patch to do this." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-78", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 525.0, 360.0, 270.0, 60.0 ], "text" : "Addresses in the matrixctrl are numbered from the upper left hand corner starting with 0, 0. Since the uzi index starts with 1 rather than 0, our first point is located at 1, 1 in the matrixctrl." } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-76", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 120.0, 402.0, 40.0, 20.0 ], "presentation_rect" : [ 148.0, 399.0, 0.0, 0.0 ], "text" : "Set" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-75", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 120.0, 383.0, 40.0, 20.0 ], "text" : "Clear" } } , { "box" : { "disabled" : [ 0, 0 ], "id" : "obj-73", "itemtype" : 0, "maxclass" : "radiogroup", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "parameter_enable" : 0, "patching_rect" : [ 95.0, 383.0, 18.0, 34.0 ], "size" : 2, "value" : 1 } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-72", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 215.0, 510.0, 270.0, 33.0 ], "text" : "Note that the message contains the last thing we sent to matrixctrl when the patch finishes." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-62", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 525.0, 135.0, 37.0, 18.0 ], "text" : "clear" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-60", "linecount" : 2, "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 26.75, 510.0, 169.25, 31.0 ], "text" : ";\rmatrixctrl 12 9 1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-58", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 54.0, 480.0, 113.0, 20.0 ], "text" : "prepend \\; matrixctrl" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-51", "maxclass" : "newobj", "numinlets" : 3, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 54.0, 435.0, 66.0, 20.0 ], "text" : "pack 0 0 0" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-50", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 54.0, 338.0, 104.0, 20.0 ], "text" : "receive num_cols" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-49", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 3, "outlettype" : [ "bang", "bang", "int" ], "patching_rect" : [ 27.0, 375.0, 46.0, 20.0 ], "text" : "uzi" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-48", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "int" ], "patching_rect" : [ 27.0, 298.0, 61.0, 20.0 ], "text" : "trigger b i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-43", "linecount" : 7, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 187.5, 395.0, 307.5, 100.0 ], "text" : "One can either process each column in a given row before moving on to the next row (as we are doing here), or each row in a given column. We just have to swap our receive statements leading into the uzi objects if we want the latter. Open the Max window to see the print object output. The order of each message is column, row, value." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-41", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 57.0, 225.0, 108.0, 20.0 ], "text" : "receive num_rows" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-40", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 3, "outlettype" : [ "bang", "bang", "int" ], "patching_rect" : [ 30.0, 255.0, 46.0, 20.0 ], "text" : "uzi" } } , { "box" : { "id" : "obj-39", "maxclass" : "button", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], "patching_rect" : [ 30.0, 225.0, 20.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-35", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 61.25, 150.0, 32.5, 18.0 ], "text" : "11" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-33", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 300.0, 150.0, 195.0, 47.0 ], "text" : "We start by setting the number of rows and columns that we want to process" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-31", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 150.0, 180.0, 91.0, 20.0 ], "text" : "send num_cols" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-30", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 180.0, 95.0, 20.0 ], "text" : "send num_rows" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-29", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 92.5, 150.0, 32.5, 18.0 ], "text" : "13" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-27", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 30.0, 150.0, 32.5, 18.0 ], "text" : "9" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-21", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 525.0, 90.0, 270.0, 33.0 ], "text" : "The object below is called matrixctrl. It can be used both for display (as here) and for input." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-19", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 246.25, 150.0, 32.5, 18.0 ], "presentation_rect" : [ 369.0, 198.0, 0.0, 0.0 ], "text" : "18" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-18", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 215.0, 150.0, 32.5, 18.0 ], "presentation_rect" : [ 339.5, 201.0, 0.0, 0.0 ], "text" : "16" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-17", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 182.5, 150.0, 32.5, 18.0 ], "presentation_rect" : [ 306.0, 194.0, 0.0, 0.0 ], "text" : "14" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-16", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 150.0, 150.0, 32.5, 18.0 ], "text" : "12" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-14", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 573.0, 135.0, 101.0, 20.0 ], "text" : "receive matrixctrl" } } , { "box" : { "columns" : 20, "id" : "obj-1", "maxclass" : "matrixctrl", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "list", "list" ], "parameter_enable" : 0, "patching_rect" : [ 525.0, 170.0, 270.0, 165.0 ], "rows" : 15 } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-4", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 90.0, 465.0, 47.0 ], "text" : "Many things that we might like to represent on a computer are two dimensional (paintings, drawings, photographs, maps, tables of data, etc.) It is thus a common task to have to automatically process each element in a grid of some kind." } } , { "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 033. Processing Grids\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, 75.0, 810.0, 495.0 ], "rounded" : 20 } } ], "lines" : [ { "patchline" : { "destination" : [ "obj-1", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-14", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-16", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-17", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-18", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-19", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-27", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-29", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-35", 0 ] } } , { "patchline" : { "destination" : [ "obj-40", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-39", 0 ] } } , { "patchline" : { "destination" : [ "obj-48", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-40", 2 ] } } , { "patchline" : { "destination" : [ "obj-40", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-41", 0 ] } } , { "patchline" : { "destination" : [ "obj-49", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-48", 0 ] } } , { "patchline" : { "destination" : [ "obj-51", 1 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 78.5, 323.0, 110.0, 323.0, 110.0, 323.0, 164.0, 323.0, 164.0, 364.0, 87.0, 364.0 ], "source" : [ "obj-48", 1 ] } } , { "patchline" : { "destination" : [ "obj-51", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-49", 2 ] } } , { "patchline" : { "destination" : [ "obj-60", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-49", 0 ] } } , { "patchline" : { "destination" : [ "obj-49", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-50", 0 ] } } , { "patchline" : { "destination" : [ "obj-58", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-51", 0 ] } } , { "patchline" : { "destination" : [ "obj-85", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 63.5, 465.0, 129.0, 465.0, 129.0, 444.0, 142.5, 444.0 ], "source" : [ "obj-51", 0 ] } } , { "patchline" : { "destination" : [ "obj-60", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-58", 0 ] } } , { "patchline" : { "destination" : [ "obj-1", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-62", 0 ] } } , { "patchline" : { "destination" : [ "obj-51", 2 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-73", 0 ] } } ], "dependency_cache" : [ ] } }