Round matrix floats
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.
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:
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 814.3ocyXssbaBCD8Y6uBFdJsiqKRxfg9T62QlLYjMxNJEjnB4D2lI+6UZA7 kVCHamP6KRVqfUm8r2D9kwi7WH2xJ889h2sdiF8x3Qi.QVAipWOxOmtcYFsD dLeA6Y4hG8mTsklsUChyjzzbVYoWXyVET8xG3h02qXK0Um.IHZZvDuDrcLBF QwSC7tq9U3oftL5+SnnF8rRJzBZNC15aJNMqYGwlb4FcFSCHCUKsRj9mErpC 02em9sppj+KXCTf432oGtXmZrxdc7X6vDG4jkx7blP+WjhRtQjZn.OpAn62u clAgfo34cRMgmK0zXnqTqW.q2Y5uWLxFCerwA6kLyNEF2o8RNW6kzVn.25DL QDSNLpnfpL5TyT2yDzEYriXrSyObMKuNqwHLBGZT3DiVClh1+qCjh2+q8BC2 g.KYkKSYGFFe0t.a1HcMqCmvbhk1wQIfO.VXi+NkOHY3xFKTrRSxDUykhC.K hXeDOBBJaDTOrSYGQW3KftZot1ib8zxBdVVG7HJ.xWwDXhzcvbv4xj3VYxIW NahC.ZDGmzOa99D7gqnoYND7E+OpUv.GFU2PDi5OJJZXCht5vAsb85LlCoPn pJRMimx1wyOSmtsnuSE6uZyrEm+OLGnRZx4B5mABgff4QMrwIYf2tDhETw5V b+jAIoPH4kLOj2JyEH0Dr2LOR+jT0EHQAcdCR7aVNhAm2mS0J91gIaoC5hss P48UXDtb4M2f9LWbK5tO7QyTP0D5t9oPTBbyKbXUdGtktUCKGN6sKjyRVEOy Eoxm6hLL27LzZ9.Yj.YcQsT2gbUUVaoOLItB.U23um9v0BWPW980f2+RCvNK xA4B4fmcUryYZmv64mwE+4mtBVgU9wFeobiZYyI270kd6MjTVolK.eygOD4n G5AdZJSbX+hTdosEB.ufS5FbEOt.GSQeScxg.Mfgi5icFN33.4LbtJrKQNCF ZbgarexwPAm.GvSxfE43huJZ3hbl6.br2sanvSrK34+pDKaalKBNUcLnEEOw Tk05DPhow3iRkcYzDXIWTsD5B4qXOwadd3eUxmpL8I0lljaTU2FZabj+X647 53eC9z.49B -----------end_max5_patcher-----------
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)*.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:)
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)
Forums > Jitter