simple input and output

May 9, 2011 at 2:18pm

simple input and output


I’m trying to do smt very simple in js inside a max patch: I wanna give three numbers to the javascript, it does a math operation and then prints out the value.

Just in js the code would be:
function r2r(r1,r2,i)
int s1 = 1;
int s2 = 127;
newi = (i-s1)*(r2-r1)/(s2-s1)+r1;
return newi;

How can I can I do that in js for max msp ?


May 9, 2011 at 10:43pm

It should be as simple as changing the return to a print() and then sending the object the three numbers you want it to use prepended with the function name, for example “r2r 12 23 5″.


You must be logged in to reply to this topic.