Forums > Jitter

Round matrix floats

Jul 29 2013 | 1:08 pm

Is there [round] equivalent for jitter? Op only does integers, and I’d lke to get my values rounded to the nearest .25 (or .0125/.00625 if possible)

I was thinking maybe an expression is possible but I’m not sure how to write it.

Jul 29 2013 | 6:26 pm

it seems round only rounds to nearest integer, and doesn’t take a second argument (either in jit.op or jit.expr).

heres a workaround:

-- Pasted Max Patch, click to expand. --


Jul 29 2013 | 8:39 pm

Ok so it did need to be an expression. Thank you very much!

So to get a better understanding of what’s going on, am I interpreting this correctly?

jit.expr is using the round op to round to the nearest integer, so the expression is as follows:

round to nearest int((by the one divided by value set at inlet 1) * matrix float from inlet 0) * value set at inlet 1)

so if I just neeeded to round to the nearest .25 and not need the 2nd inlet, the expr could go as: round((1/.25)*in[0])*.25

Is that right? It seems so…
I figured it wouldn’t need to be an advanced expression, but I need to increase my math skills.

I’ll post my patch when I finish it (M4L device)
This will be very helpful in another context later on, as well:)

Thanks again:)

Jul 30 2013 | 2:06 am

yep, no worries , your interpretation is correct (btw jit.expr (and jit.op for that matter) is not well documented, so your kind of quandary is to be expected)

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > Jitter