round values to next in list...


    Dec 18 2013 | 9:46 pm
    really simple problem i think, but i cant think of any simple solution - maybe you guys have an idea how to do this:
    I have a list of variable length with floats. eg: [10. 34.5 50. 72.] and an input value from 0. to 100.. now what i want is a simple function wich outputs 10. for the input range of 0. to 10.; 34.5 for the input range of 10.000001 to 34.5; 50 .... ect. you get the idea.
    whats the easiest and most efficient way to create such a function with a variable number of points?
    best,
    plinio

    • Dec 18 2013 | 9:48 pm
      i thought about writing the values into a buffer and reading from that - but thats to much msp for me...
    • Dec 18 2013 | 10:29 pm
      okay - for now i used the function object - looking for better ideas though.
    • Dec 19 2013 | 4:11 am
      With a handful of values like you have, [split] could work. The challenge might be assigning the min/max and output values as the input list changes
    • Dec 21 2013 | 10:37 pm
      if the lists are short, say of 5 elements, something like split would be perfect.
      if the lists contain 100 elements, you better try to iterate it and build the process around single elements.
    • Dec 22 2013 | 2:20 am
      I call this "quantize to list". Enjoy :)