How to scale a list in Max?
How to scale a list in Max?
I know there is ej.lscale:http://www.maxobjects.com/index.php?v=objects&id_objet=3084&PHPSESSID=d7fa2b548e842525ec85e8588a77dfe4
but I don't want to use external objects...
Thank you
Quote:How to scale a list in Max?
Well, you could unpack the list, scale the bit, then pack it back up. Or you could convert your list into a matrix using the jit.fill object, run it through jit.scalebias, then use jit.spill to dump it back out, or you could....
As is usually the case in Max, there's always another way to do it. Since we don't know anything specific, those are as good a pair of guesses as any.
Gregory Taylor wrote on Sun, 23 August 2009 14:58Quote:How to scale a list in Max?
Well, you could unpack the list, scale the bit, then pack it back up. Or you could convert your list into a matrix using the jit.fill object, run it through jit.scalebias, then use jit.spill to dump it back out, or you could....
As is usually the case in Max, there's always another way to do it. Since we don't know anything specific, those are as good a pair of guesses as any.
There's also vexpr.
The [vexpr] object would be my choice too. Try [vexpr (($f1-$f2)/($f3-$f2))*($f5-$f4)+$f4 @scalarmode 1] with your list in the first inlet and scaling numbers in the remaining four to work much like [scale] does.
lh
FYI, in the next incremental scale and zmap will accept lists in their left inlet. Fancy, isn't it?
Emmanuel Jourdan wrote on Mon, 24 August 2009 03:50FYI, in the next incremental scale and zmap will accept lists in their left inlet. Fancy, isn't it?
Wow, that's a great addition to what you can do with vexpr, since with scale and zmap you can specify the range and scaling exactly, plus decide whether you want out-of-bounds values (scale) or cap the values (zmap). Great to hear!
Emmanuel Jourdan wrote on Mon, 24 August 2009 10:50FYI, in the next incremental scale and zmap will accept lists in their left inlet. Fancy, isn't it?
yes, but who wants to use those?
-110
Roman Thilenius wrote on Tue, 25 August 2009 05:33Emmanuel Jourdan wrote on Mon, 24 August 2009 10:50FYI, in the next incremental scale and zmap will accept lists in their left inlet. Fancy, isn't it?
yes, but who wants to use those?
-110
Those of us who hate math. JK.
No, my vote goes for vexpr as well. I still have to check out those jitter objects for list processing though.
the most basic structure for processing list elements should be that:
using vexpr can get difficult when you have operands/arguments.
That's just what the object does internal... it just does it way faster...
sure, but in max4 i can not do + 1 to list 1 2 3 4 5 6 7 8 9 i have to do + list 1 1 1 1 1 1 1 1 1, right?
(i´d love to be wrong here...)
that would involve a uzi at some point which is not nice when
the operand changes often under metro conditions.
last but not least one might want to perform things to lists
which are not possible or less efficient in vexpr.
say, like [clip], which reads
((max($f1,$f2))*($f1=$f3))) + ($f1*($f1>=$f2 && $f1
in a [vexpr].
also, in OS 9 i think i saw that [vexpr] wasnt able to take
ints as floats (like [expr] does), but again, maybe i am just
wrong about it.
if i am not wrong, that´d mean that you need to make 2 different
patches for a vectral mtof and a vectral "mtof 0." - using the
zl len zl group method just lets you use arguments to patcher
for int/float mode of the embedded mtof object.
-110
.
The [vexpr] object works with floats and ints just as [expr] does and if you set the @scalarmode 1 attribute then you only have to send single numbers to the other inlets, there's no need to duplicate them into a list.
lh
Roman Thilenius wrote on Wed, 26 August 2009 22:46
sure, but in max4 i can not do + 1 to list 1 2 3 4 5 6 7 8 9 i have to do + list 1 1 1 1 1 1 1 1 1, right?
(i´d love to be wrong here...)
ah, you are right,it works - but only in 4.6.
i would love it to work in 4.1 and 4.5 too.
if it is not downwards compatible it is currently not very useful
for me, at least not in "abstractions" or "methods".
I'm not familiar with vexpr
can someone share a simple example?
This is what I would like to do:
to convert 512 sliders with the range of 255 to 512 sliders with the rande of 0. to 1.
by the way, how can one convert a 512 list to a 1024 one, where the first slider of the 521 list corresponds to the first two sliders of the 1024 list, the second slider of the 521 list correspond to sliders 3 and 4 of the 1024 list, and so on...?
Thank you so much, and enjoy the summer sun (since I cannot)
like this... no ?
[vexpr $f1/ 255. @scalarmode 1]
whell...
[vexpr $i1/255.]
never thought it was so simple...
Still need help with the 512 list conversion to a 1024 list..
Thanks!
and this for your second question :
Do you want to duplicate everything in the 512 list so that "1 2 3" would be "1 1 2 2 3 3" etc? If so have a look at the [zl lace] object.
lh
Thank you so much for your wiseness, fp and thereishopeforus!!
What I love about Max is that we're always learning while we're patching!
Thanks again