Converting 3-plane matrix to 1-plane, strange jit.expr behavior

dtr's icon

Hi there,

I want to convert a 1-dimension 3-plane matrix with RGB values to a 1-dimension 1-plane matrix, which I will eventually unroll as a list and send over a serial connection. So principle is:

3-plane matrix : r1 b1 g1, r2 b2 g2, ...
to
1-plane matrix: r1, b1, g1, r2, b2, g2,...

I came up with a jit.expr that works. A bit. 'Cause from cell 65 on it glitches. Then the R value of a cell ends up in the next cell, not the right one. It seems like some kind of rounding error.

Max Patch
Copy patch and select New From Clipboard in Max.

Any thoughts on getting this right? Not necessarily using jit.expr.

dtr's icon

Interestingly this jit.gen alternative displays a similar glitch from cell 50 on:

Max Patch
Copy patch and select New From Clipboard in Max.

I'm sure I'm missing something simple here... but what?

dtr's icon

Ok I solved it with jit.multiplex:

Max Patch
Copy patch and select New From Clipboard in Max.

Still interested to learn why my previous alternatives didn't work though.