what object sends values ​​greater 0 to left and ​​below 0 to the right out ?

Oct 16, 2011 at 12:01pm

what object sends values ​​greater 0 to left and ​​below 0 to the right out ?

Object needet that:

sends values ​​greater than 0 to the left and send values ​​below 0 to the right output

thanks,
hgh

#59348
Oct 16, 2011 at 12:10pm

Use a [gate] with one of the comparison objects. You will need to be careful about processing order.

#213498
Oct 16, 2011 at 12:15pm

For instance:

– Pasted Max Patch, click to expand. –
#213499
Oct 16, 2011 at 12:20pm

[if $i1>0 then $i1 else out2 $i1].

#213500
Oct 16, 2011 at 12:46pm

cool: my favorite is [if $i1>0 then $i1 else out2 $i1]

thank you very much!!! ;)

#213501
Oct 16, 2011 at 3:17pm

You can also try [sadam.split 0] from the sadam Library, although that would send the values below 0 to the left outlet and above 0 to the right. Setting the @strict attribute will let you decide if you want to get the exact 0 values on the left or on the right.

#213502
Oct 16, 2011 at 11:08pm

Yes, [if] can be a handy shortcut. But you should be aware of the gate technique, which can be a very useful approach for a multitude of tasks.

BTW, being in a hurry, I made a silly mistake in the example I posted. Fixing it is left as an exercise to the reader. One way would be to replace the [gate 2] with a graphic gate, but extra points for solutions w/out UI objects.

#213503
Oct 17, 2011 at 2:29am

@Peter

I’m always (usually) in for extra points (and interested in puzzles). It seems you forgot that the comparator (< 0) gives out 0 or 1. 0 closes the whole thing and 1 only opens the first gate.

A possible solution is adding 1 to the outcome, as such:

– Pasted Max Patch, click to expand. –

But, as you said, this does indeed leave a little vagueness as to the 0.

SO, how many points did I score? ;-)

#213504
Oct 17, 2011 at 3:42pm

The [+ 1] after the comparison was what I was after and you get full points for that!

#213505

You must be logged in to reply to this topic.