Assistance with creating a Logic Counter with a few simple objects.
I just began using Max and was wondering if I could get a bit of assistance understaning the logic of this simple problem.
I need to create a counter that begins at 1, counts upwards to 8 and then loops back again beginning at 1, not zero.
Here is some more info, plus what I have so far. I just don't know how to incorporate the integer storage so that the counter resets at 1 instead of 0.
Instructions:
Use these objects only (you will need only the ones that are on the patching window): 1 [toggle], 1 [integer number boxes], 1 [metro], 1 [i] (integer storage–don't confuse with this with [integer number box]), 1 [+] (addition), and 1 [%] (modulo)
For Part 1 of this assignment - make a counter that counts from 1 (one) to 8 (eight) cyclically.
Additional note for Part 1:
The logical counter should have a user-definable upper limit. In other words a counter that loops over a series of numbers, once it arrives at the upper limit the counter is automatically reset to 1 (not zero). Often counters that are used in musical applications will count to a maximum of 16 (as in 16 beats in a bar or 16 subdivisions in a beat) – use your imagination and see how such a counter could be applicable.
Patch:
{
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 7,
"minor" : 3,
"revision" : 4,
"architecture" : "x86",
"modernui" : 1
}
,
"rect" : [ 35.0, 85.0, 1016.0, 904.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 1,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 1,
"objectsnaponopen" : 1,
"statusbarvisible" : 2,
"toolbarvisible" : 1,
"lefttoolbarpinned" : 0,
"toptoolbarpinned" : 0,
"righttoolbarpinned" : 0,
"bottomtoolbarpinned" : 0,
"toolbars_unpinned_last_save" : 0,
"tallnewobj" : 0,
"boxanimatetime" : 200,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"style" : "",
"subpatcher_template" : "",
"boxes" : [ {
"box" : {
"bubble" : 1,
"bubbleside" : 0,
"id" : "obj-6",
"linecount" : 3,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 628.5, 386.539001, 150.0, 67.0 ],
"style" : "",
"text" : "FINAL RESULT. NEEDS TO START AT 1 AND NOT 0."
}
}
, {
"box" : {
"bubble" : 1,
"id" : "obj-5",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 419.0, 139.0, 150.0, 24.0 ],
"style" : "",
"text" : "Toggle to Begin"
}
}
, {
"box" : {
"bubble" : 1,
"bubblepoint" : 0.59,
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-16",
"linecount" : 5,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 888.0, 141.0, 68.0, 79.0 ],
"style" : "",
"text" : "Build your code for Part 1 here",
"textcolor" : [ 1.0, 0.084586, 0.238643, 1.0 ]
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-59",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 701.562683, 112.684631, 29.5, 22.0 ],
"style" : "",
"text" : "%"
}
}
, {
"box" : {
"id" : "obj-40",
"maxclass" : "toggle",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 604.738647, 112.684631, 20.0, 20.0 ],
"style" : ""
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-30",
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 796.628601, 112.684631, 50.0, 22.0 ],
"style" : ""
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-21",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 862.181641, 112.684631, 29.5, 22.0 ],
"style" : "",
"text" : "+"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-17",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"patching_rect" : [ 749.095642, 112.684631, 29.5, 22.0 ],
"style" : "",
"text" : "i"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-1",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 643.920898, 112.684631, 41.0, 22.0 ],
"style" : "",
"text" : "metro"
}
}
, {
"box" : {
"bubble" : 1,
"bubbleside" : 2,
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-3",
"linecount" : 2,
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 601.0, 38.0, 205.0, 53.0 ],
"style" : "",
"text" : "Use just these objects and nothing more to complete the task for Part 1.",
"textcolor" : [ 1.0, 0.084586, 0.238643, 1.0 ]
}
}
, {
"box" : {
"id" : "obj-123",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 353.924561, 172.097656, 71.0, 22.0 ],
"style" : "",
"text" : "metro 1000"
}
}
, {
"box" : {
"id" : "obj-122",
"maxclass" : "toggle",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 385.924561, 139.0, 24.0, 24.0 ],
"style" : ""
}
}
, {
"box" : {
"bubble"
Thank you for your help!
-Adriano
If this is a class assignment, had you considered asking your fellow students or your teacher?
In the future, the best way to share Max patches is to select the part of the patch you wish to share, choose "Copy Compressed" from the Edit menu, and than paste *that* into your email. It saves a lot of space, and make it easier for us to copy and past the patch in.
Thank you for teaching me how to paste code on the forum properly if its needs inspection, and I will seek assistance at my school when available. I was just looking for another opinion elsewhere to see if someone may share a different perspective on the issue.
You're very welcome.
One thing you might consider would be to assume that your patch is counting from and looping from zero to one less than your upper limit and then add one at the very end.
Main thing with any kind of counter is also the way to reset it so that it starts
from where one wants it to.
You might ask Your teacher how would he do it with just that objects...