Output specific numbers from a slider
I have a slider in the range from 1 to 64. I only want to output the numbers: 1,2,4,8,12,16,20,24,32,48,64. (in the attached maxpat-file the slider goes just to 16)
I don't know if its possible within max8?! I tried to write a js object (just until the number 16 to test it) but it doesn't work. I only get the output "1".
connected the output of the slider to a integer-box --> [pak I] --> [prepend divide] --> inlet of [js divide.js]
the divide.js-code:
autowatch = 1;
inlets = 1;
outlets = 1;
function divide(zahl) {
if (zahl = 1) {
outlet(0,1);
}
else if (zahl = 2) {
outlet(0,2);
}
else if (zahl <= 4){
outlet(0,4);
}
else if (zahl <= 8) {
outlet(0,8);
}
else if (zahl <= 12){
outlet(0,12);
}
else {
outlet(0,16);
}
}
you are only matching 11 numbers in range of 64.
That slider would not be much fun to use
if one has to pinpoint 11 of 64 values to output anything
I would rather set it's range to 0 - 11
and then use 0 = 1 , 1 = 2 .... 11= 64.
even umenu filled with that 11 numbers would do...
here few examples with dynamic list and slider range
using umenu or zl combo ...

thanks a lot for your answers! extremely helpful & important inputs for a beginner in max!