Putting lists into matrices, but indices go every 2, every 3, etc.

seejayjames's icon

I have a list from [matrixctrl] which I want to put into a jit.matrix. But I want the first element of the list to go to cell 0, the second to go to cell 2, the third to cell 4, etc. Or skip by 3s, 4s, etc., consistently. This is so the "master" set of tracks (beats) has a higher resolution than the [matrixctrl], for comparison to live input later (which could be off by a bit).

I'm using [listfunnel] and multiplying the indices by the factor I want, then using "setcell". Works fine and seems quick enough for what I need, but I'm sure this is slow in general. Any way to tell jit.fill to skip indices like that? Or is there another workaround?

Might be nice to have that as a second argument to jit.fill, and the reverse for jit.spill: take every 2nd, 3rd, 4th element of the incoming list, rather than the whole thing. Would allow for some interesting "upsampling" and "downsampling" possibilities, maybe.

Zachary Seldess's icon

Hi seejayjames,

The way you're doing sounds fine to me, from what I can deduce without a patch. You might consider just dumping the list into a matrix without the spaces, and then using [jit.multiplex] from there.

best,
Zachary

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

seejayjames's icon

Hey, that's great... jit.multiplex. Thought there had to be something like that for mixing matrices.

Though I wonder whether there's a way to utilize jit.expr and have it operate on cells on an index basis, so you could specify something different to happen every 3rd cell, for example. Like a "pre-expr" modulus which indicates which cells do or don't get the operation. Without iterating through the whole thing (though internally I imagine it would anyway).

Regardless, that was helpful and gave new ideas, thanks!

Jesse's icon

Another way to do this is lmerge from the lobjects collection.

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

(From the help file)