Something like [match], but for lists, checking for conditions.

Dec 3, 2012 at 1:29am

Something like [match], but for lists, checking for conditions.

I know match takes lists, but it takes “consecutive lists”, that means if you feed it a “list” it takes it in as a series of numbers.

I have 8 sliders, when all are at 0 i’d like the patch to send a “poly mute” message.
The problem is that when I move the first slider, the sequence is 1 0 0 0 0 0 0 0, and if/when I move the next one, it goes like 0 2 0 0 0 0 0 0. So you already have 8 zeros and Match outputs it…

So i need something that checks and outputs only if ALL conditions are met.

thanks.

#65475
Dec 3, 2012 at 2:00am

You could do something like this:

{
“boxes” : [ {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 21.0, 311.0, 20.0, 20.0 ],
“id” : “obj-37″,
“outlettype” : [ "bang" ]
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “t b i”,
“fontsize” : 12.0,
“numinlets” : 1,
“numoutlets” : 2,
“patching_rect” : [ 156.0, 218.0, 32.5, 20.0 ],
“id” : “obj-33″,
“fontname” : “Arial”,
“outlettype” : [ "bang", "int" ]
}

}
, {
“box” : {
“maxclass” : “slider”,
“numinlets” : 1,
“numoutlets” : 1,
“patching_rect” : [ 156.0, 22.0, 20.0, 140.0 ],
“id” : “obj-34″,
“outlettype” : [ "" ],
“parameter_enable” : 0
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “== 0″,
“fontsize” : 12.0,
“numinlets” : 2,
“numoutlets” : 1,
“patching_rect” : [ 156.0, 186.0, 35.0, 20.0 ],
“id” : “obj-35″,
“fontname” : “Arial”,
“outlettype” : [ "int" ]
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “t b i”,
“fontsize” : 12.0,
“numinlets” : 1,
“numoutlets” : 2,
“patching_rect” : [ 111.0, 218.0, 32.5, 20.0 ],
“id” : “obj-30″,
“fontname” : “Arial”,
“outlettype” : [ "bang", "int" ]
}

}
, {
“box” : {
“maxclass” : “slider”,
“numinlets” : 1,
“numoutlets” : 1,
“patching_rect” : [ 111.0, 22.0, 20.0, 140.0 ],
“id” : “obj-31″,
“outlettype” : [ "" ],
“parameter_enable” : 0
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “== 0″,
“fontsize” : 12.0,
“numinlets” : 2,
“numoutlets” : 1,
“patching_rect” : [ 111.0, 186.0, 35.0, 20.0 ],
“id” : “obj-32″,
“fontname” : “Arial”,
“outlettype” : [ "int" ]
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “t b i”,
“fontsize” : 12.0,
“presentation_rect” : [ 173.0, 255.0, 0.0, 0.0 ],
“numinlets” : 1,
“numoutlets” : 2,
“patching_rect” : [ 66.0, 218.0, 32.5, 20.0 ],
“id” : “obj-27″,
“fontname” : “Arial”,
“outlettype” : [ "bang", "int" ]
}

}
, {
“box” : {
“maxclass” : “slider”,
“presentation_rect” : [ 173.0, 59.0, 0.0, 0.0 ],
“numinlets” : 1,
“numoutlets” : 1,
“patching_rect” : [ 66.0, 22.0, 20.0, 140.0 ],
“id” : “obj-28″,
“outlettype” : [ "" ],
“parameter_enable” : 0
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “== 0″,
“fontsize” : 12.0,
“presentation_rect” : [ 173.0, 223.0, 0.0, 0.0 ],
“numinlets” : 2,
“numoutlets” : 1,
“patching_rect” : [ 66.0, 186.0, 35.0, 20.0 ],
“id” : “obj-29″,
“fontname” : “Arial”,
“outlettype” : [ "int" ]
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “if $i1 && $i2 && $i3 && $i4 then 1″,
“fontsize” : 12.0,
“numinlets” : 4,
“numoutlets” : 1,
“patching_rect” : [ 21.0, 271.0, 189.0, 20.0 ],
“id” : “obj-14″,
“fontname” : “Arial”,
“outlettype” : [ "" ]
}

}
, {
“box” : {
“maxclass” : “slider”,
“numinlets” : 1,
“numoutlets” : 1,
“patching_rect” : [ 21.0, 22.0, 20.0, 140.0 ],
“id” : “obj-3″,
“outlettype” : [ "" ],
“parameter_enable” : 0
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “== 0″,
“fontsize” : 12.0,
“numinlets” : 2,
“numoutlets” : 1,
“patching_rect” : [ 21.0, 186.0, 35.0, 20.0 ],
“id” : “obj-2″,
“fontname” : “Arial”,
“outlettype” : [ "int" ]
}

}
],
“lines” : [ {
"patchline" : {
"source" : [ "obj-14", 0 ],
“destination” : [ "obj-37", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-33", 1 ],
“destination” : [ "obj-14", 3 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-30", 1 ],
“destination” : [ "obj-14", 2 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-27", 1 ],
“destination” : [ "obj-14", 1 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-2", 0 ],
“destination” : [ "obj-14", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-33", 0 ],
“destination” : [ "obj-14", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-30", 0 ],
“destination” : [ "obj-14", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-27", 0 ],
“destination” : [ "obj-14", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-34", 0 ],
“destination” : [ "obj-35", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-35", 0 ],
“destination” : [ "obj-33", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-32", 0 ],
“destination” : [ "obj-30", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-31", 0 ],
“destination” : [ "obj-32", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-28", 0 ],
“destination” : [ "obj-29", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-29", 0 ],
“destination” : [ "obj-27", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
, {
“patchline” : {
“source” : [ "obj-3", 0 ],
“destination” : [ "obj-2", 0 ],
“hidden” : 0,
“disabled” : 0
}

}
],
“appversion” : {
“major” : 6,
“minor” : 0,
“revision” : 8
}

}

#235925
Dec 3, 2012 at 1:44pm

Hi,

If you just want to test for “all sliders are zero”, you could just use [zl sum] and test the output.

It’s inelegant but quick.

Best

Richard

#235926
Dec 3, 2012 at 3:57pm

@ Richard : is that what you mean ? How is it that the button doesn’t light on when the condition is not true in gwsounddsg’s solution and does in mine ?

– Pasted Max Patch, click to expand. –
#235927
Dec 3, 2012 at 4:46pm

@Stephane Morisse : gwsounddsg’s solution compressed and fixed.

– Pasted Max Patch, click to expand. –
#235928
Dec 3, 2012 at 7:21pm

@nicolas Thanks man. Sorry about not compressing my patch. It was late and I hit submit before I looked at it.

#235929
Dec 4, 2012 at 10:46am

@Stephane Morisse : Yes, that’s what I had in mind, although I don’t think the argument (value 4) in [zl sum] does anything.

Richard

#235930
Dec 5, 2012 at 10:17am

@Richard Garret: That’s perfect!
I really only need to know if the sum is zero or bigger, in order to send mute/unmute to poly~.

#235931

You must be logged in to reply to this topic.