## scale values for every cell in matrix?

Mar 15 2016 | 9:56 am
is there an easy way to scale every value in a matrix? I mean just like the scale object, which allows me to set an low and high input and a low and high output. i.e. take all matrix cell values from 205 to 255 and scale them from 127 to 255.
The jit.scalebias doesn't do this, and I can't seem to figure out how to scale like that using jit.op
any ideas? I've considered using jit.spill and a several [scale] objects, but that seems like a tedious solution.

• Mar 17 2016 | 7:23 pm
jit.gen and the scale operator
• Mar 18 2016 | 5:50 am
thanks, Rob!
• Nov 09 2019 | 7:21 pm
Alright, I think this is loosely still on topic. I'm using a matrixctrl object to manage a gates, and have modified the phasor~ based clock (originating from Gregory Taylor's Step by Step book) which is capable of subdividing the bar down to any tuplet up to 128 (at present). I feel like the logical next step would be to scale (or down/ up-sample) the pattern (column-wise -- quantizing the cell data to the lower/ scaling to the higher, rather than just truncating or extending), which led me here. I've read through the jit.gen reference and have seen the list of operators under jit.op, but have seen nothing with regard to the scale operator. Have I managed to overlook something or? I will say I found the jit.gen example snippet (gen.waves) and have achieved the desired scaling behavior (X-wise) by detaching [swiz y] and [sin], but I'm struggling to figure out how to situate(/ format) jit.gen to communicate with (receive/ send cell data from/ to) matrixctrl.
• Nov 09 2019 | 11:32 pm
Hey Aaron, (jitter) matrix != matrixctrl or matrix~, they are quite unrelated.
• Nov 10 2019 | 12:07 am
My apologies. To clarify — am I wrong in thinking that I should be able to convert a matrixctrl list to a format that jit.matrix is able to understand, and populate said matrix with those black & white values? (To then process and convert back.)
Perhaps there’s a more efficient way (using zl/ other forms of list processing) to wrap/ scale/ fold and/ or whatever else to a matrixctrl list, but I’m not that adept and such methods haven’t occurred to me.
The thing that gave me the idea was using jit.noise/ jit.matrix to populate matrixctrl with cells — I assume if that’s possible, the reverse should be possible as well. My apologies if I’m mistaken.
• Nov 10 2019 | 5:28 am
That could be a starting point.
• Nov 10 2019 | 12:18 pm
The other way around:
But the question is – what do you want to achieve: neither (imo) jitter matrix nor matrixctrl are primary meant as a step sequencers, but can be used that way. If you want to scale values of vertical position you can do fe. this:
• Nov 10 2019 | 4:12 pm
Thanks so much for the help and suggestions, guys. This is the general concept -- Basically pattern resampling (up or down in resolution/ step length):
In Gregory Taylor's book, he uses [matrixctrl] to manage gates (or counts that sound) in tandem with [live.step]. I was wanting to have the option of modulating the step length/ column count without truncating or extending the pattern. My current thoughts are: 1. The conversion back to matrixctrl list appears to be getting thrown by the changing column count. 2. It'd be nice if there were a way of toggling whether repeats were represented or ignored when returning to matrixctrl. 3. Perhaps this isn't necessary, and there's a way of doing this without using a conversion to jit.matrix. (Perhaps KLSDIZ's suggestion of using scale would work in this manner, but I figured I'd go ahead and share this, incase my desired result was unclear.)
• Nov 10 2019 | 7:33 pm
while it can be cool to use a matrix to handle or store and recall data in bunches, i dont think it is required to do it for a simple 2 D matrix. i also dont think you need to use float32 to store 0s and 1. it starts making sense when you use one matrix to store 10 such sequences, each of 5 rows, in 10 dimensions. also, if you use use a matrix as "database" anyway, you could as well get rid of the matrixcontrol object and use the jit.pwindow as GUI object: [route mouseidle] [unpack 0 0] [/ 10] [/ 10] ...
• Nov 10 2019 | 8:53 pm
Re: float32 -- lol, that's fair, yeah. *further indicating my comparable inexperience* Re: jit.pwindow & jit.matrix -- Oh, interesting. I'm not sure I've encountered those being used in place of [matrixctrl]. Why would anyone use [matrixctrl], if they are capable of serving the same function, while offering more flexibility? (Or at least, why is [matrixctrl] as ubiquitous as it seems to be?) (And yes, I'm currently hunting down more info on how to set them up in the way I've come to use matrixctrl. The reference/ help files were the first places I visited.)
• Nov 10 2019 | 10:16 pm
Also, in the patcher attached to my second last post, the dimensions pulled from [jit.matrixinfo] (in the subpatcher titled "jitmatrix_2_ directly above the final matrixctrl object) are never the same dimensions as are being sent. I have no idea why this is, or why any attempt to compensate/ correct incurs a slew of error messages/ stack overflow. I've gone ahead and included a de-encapsulated version with additional comments in this one:
• Nov 11 2019 | 3:06 pm
You would use a float32 matrix if you wanted to use the continuous mode of [matrix~]. When you do that, you can store the internal values of [matrix~] in a float32 [jit.matrix]. If you want to use [jit.pwindow] as interface, you can display the value as a gray level value and click & drag the mouse to raise/lower the value. I used this technique a long time ago, but was not satisfied with the user experience with this kind of matrix interface.
• Nov 11 2019 | 3:17 pm
it is a pity that there are no 2-bit matrixes; you always waste a lot of space storing "on/off" type of data in an 8bit matrix channel.
• Nov 11 2019 | 4:01 pm
1-bit would suffice.
• Nov 11 2019 | 4:39 pm
:)
• Nov 11 2019 | 9:16 pm
@Aaron Find *one* difference :P :
• Dec 03 2019 | 4:10 am
@KLSDIZ: my sincerest apologies for the lack of response. I was pretty swamped in prep for a set that I didn't return once I found a fix for the issue I was experiencing. (I believe it was an ordering issue) Anyways, I sincerely appreciate the effort to assist. <3
• Apr 17 2020 | 12:47 pm
Alright, so I've been on an off working on a solution for scaling matrixctrl cell states for a while. My first attempt was to convert matrixctrl to jit.matrix and resample that image, and convert back. The issues with that being: 1. Repeats occur when upsampling a state to a higher resolution. 2. it's not very efficient (most felt when dealing with larger column/ row counts) So I started working on another method using two expr (I've also tried vexpr) objects to scale, with a modulo following to confine the values to the desired row/ column count. The issue I believe I'm running into with it, is that cells aren't told to clear when the resolution shifts. That and perhaps some bugs with regard to ordering operations. I've attached a patch including the latter attempt and some commentary. If anyone has a moment to give this a glance over, I'd love to hear their thoughts. Perhaps there's a better way of going about this than I've been able to think of. Any additional insight would be very much appreciated. Sincerely, Aaron