Matrix/array in gen~

brunatius's icon

Is there a data structure that is matrix like, Similar to what we have in jit.gen?

What are the options if I want sample rate control over a 1000x1000 matrix in a codebox?

Wetterberg's icon

Well shit. This is pretty huge, and I find myself craving that sort of data access... but how do I begin to dive into this? Raja, any ideas on how to get me past the "hacking" stage of gen?

brunatius's icon

Hi Raja, thanks for the reply. My question was ill posed, let me be a bit more concrete and clear. I am basically trying to test run different physical modeling models, ie, a plate in 2D. So, this means that not only do I need to have a way to apply a function to a 2d array (trivial with while/for loops, just not optimal) but I also need to iterate (at least) at each sample and keep the previous value. This works for History but I'm not sure if there's a way to do it combining history and data?

I read about data but when I saw "channels", had alarm bells in my mind saying this is likely not optimized for acting as a 2d matrix.

I'm wondering if the right answer is an external.. :-/

Btw, I think it would help a lot if cycling included in the help files how to properly implement these things in codebox, a simple function "header" (.h style) would do as opposed to us trying to figure out the proper syntax...

noou's icon

Hello, perhaps any news in this regard? I just approached gen/gen~ and while I was happy to see for(), while() loops and conditional statements, I'm pretty disappointed there's no way to use arrays or matrices...

testcase's icon

data and buffer are arrays. if you want to treat them as 2d or Nd that is pretty straightforward. as far as jitter matrix - one could use jit.buffer~ to convert a matrix to a buffer and then read/write to it in gen~ and then convert back to a matrix.