Forums > MaxMSP

round values to next in list…

Dec 18 2013 | 1: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?


Dec 18 2013 | 1: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 | 2:29 pm

okay – for now i used the function object – looking for better ideas though.

Dec 18 2013 | 8:11 pm

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

-- Pasted Max Patch, click to expand. --


Dec 21 2013 | 2: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 21 2013 | 6:20 pm

I call this "quantize to list". Enjoy :)

-- Pasted Max Patch, click to expand. --


Viewing 6 posts - 1 through 6 (of 6 total)

Forums > MaxMSP