js-object timing issue
i just made a js script, wich does a pretty simple thing:
creating a ramp from 0 to n-1 with a delay(ms) after each
increment. (of course something similar is already done as
max externals, but for now i like to understand and recap things with scripting)
when adjusting a very small ms delay value (as argument of the js object)
i get irregular output of js object. it ramps, but not to the
expected value (n-1). in the appended patch i like to ramp to the value 1999. with 20ms everthing working fine, but the smaller the interval gets the bigger the difference between n-1 and the outputs gets. for example:
each time i ramp with 2 ms it stop at different vals. 1976, 1997 etc.
why is it?
is this because the js stuff is executed at low priority at the max sheduler?
i also looked for an alternative to the "task"-way,
but settimeout does not seem to work within the js object…
----------begin_max5_patcher---------- 553.3ocuVEriaBCD8L7ULB0CsR6FYSfTRu0uipUUFXRhSw1HrQMaWs+601P5 x1zzRnrbwJL1Y7ady6MvSgAQ4pSnNB9D7EHH3ovf.eHWff9mChDrSEULs+XQ BTqY6wn651yfmL93MLQM7N5436TRil+CzsGMdEoObMyTbfK2+0FrvzcsIT6t P1Z2ZZpaklsh.Oz+OjsBtrBM9aO9kfpVy4nz9n7RORT4GumRFBDIS3ARzma3 rpy6zkAyi0XGPhhfGb67bXna4tQRHR761a7B9nRwJcbEDSHjamU1j3YhMt0s tSZyy0XE5XYkjEiTJTBAJMWvJVTXKQf0rGzVbBlCHThUrGg2Kze.X6LXCfrh C.WVzfCyQEWhEpVoYnPntA01yvLbkb.6Qi8DGcsWUQ5W9E6M91.MtSQlz0NR 8oZcxs0IHW1IV+W5DyHcKXeCAF38l6ZTBf.FEHueB1zsdpLY8.d3VUj+AdHd d4g7ViQIi9WCa5rUwjYxVkcUySNSteVmpXQhF2wqr1joNokR7U+lsyT0SoK2 n1VQ9zK7Ns6zjtwWV2oSnr4NO5afrntwlYvdcSVT7Q+btzjYxWSmYi8Up6iZ 3nA0F5J6uhmbw2oLxnyki3+1P3Af+Md+12l4qAW7WyUZUaSw4T0CA3kxnzRQ bo+kjCOS7qNzAdYIJG1OE7xZkUX0igqHXGMjFElVVHQFCjVVLkNFHQVTHkLB HktnHJ6MFQ1GdN7mxNcBQB -----------end_max5_patcher-----------
BTW. iam on a macbook 10.6.8 with max 5.1.9.
thanks for your help,
"rep.immediate = 1;" fixed it. i made a test where i count from 0 to 1.000.000 with 2 ms delay and it absolutly matches!
I don’t suppose you have the solution to this that you’re willing to share.
I’ve got a similar problem with the timing issue where I want to subtract one from a number every three milliseconds.
Can you help me out please?