How to scale a list in Max?


    Aug 23 2009 | 9:31 pm
    How to scale a list in Max?
    I know there is ej.lscale:
    but I don't want to use external objects...
    Thank you

    • Aug 23 2009 | 9:58 pm
      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.
    • Aug 23 2009 | 11:19 pm
      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.
    • Aug 24 2009 | 12:36 am
      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
    • Aug 24 2009 | 8:50 am
      FYI, in the next incremental scale and zmap will accept lists in their left inlet. Fancy, isn't it?
    • Aug 25 2009 | 6:42 am
      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!
    • Aug 25 2009 | 11:33 am
      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
    • Aug 26 2009 | 4:50 am
      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.
    • Aug 26 2009 | 4:52 am
      No, my vote goes for vexpr as well. I still have to check out those jitter objects for list processing though.
    • Aug 26 2009 | 7:30 pm
      the most basic structure for processing list elements should be that:
      max v2;
      using vexpr can get difficult when you have operands/arguments.
    • Aug 26 2009 | 8:15 pm
      That's just what the object does internal... it just does it way faster...
    • Aug 26 2009 | 8:46 pm
      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
      .
    • Aug 26 2009 | 9:52 pm
      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
    • Aug 27 2009 | 7:09 am
      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...)
    • Aug 30 2009 | 3:27 pm
      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".
    • Sep 01 2009 | 4:23 pm
      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)
    • Sep 01 2009 | 4:44 pm
      like this... no ?
      [vexpr $f1/ 255. @scalarmode 1]
    • Sep 01 2009 | 4:53 pm
      whell...
      [vexpr $i1/255.]
      never thought it was so simple...
      Still need help with the 512 list conversion to a 1024 list..
      Thanks!
    • Sep 01 2009 | 4:54 pm
      and this for your second question :
    • Sep 01 2009 | 4:55 pm
      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
    • Sep 02 2009 | 3:22 pm
      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