Forums > Javascript

javascript for timing relevant processing possible?

October 7, 2012 | 11:40 am

Hi Forum,

i want to process midi messages in Max4Live using JavaScript. The processig itself is simple and will take nearly zero cpu time. So Javascript general performance should not be a problem for me…

Anyhow, In the forum i read that the immediate property is not working on max5 (Windows) and is deprecated in max6. So with this limitation is it possible at all to write timing relevant code in max with javascript? What about the LiveApi JavaScript object? Is Java then an alternative (anyhow i would prefer JavaScript if possible because its totally integrated in max).

Can someone shed some light on this topic? Many thanks in advance!

Bye, Dirk.


October 7, 2012 | 5:42 pm

No.. as you know javascript in max Always run,exec in low-priority thread and if it’s find it’s self in high it’s force to be low..
the result is the same as you know … 5ms or 5 sec. if some thing is running on the same thread of js you get delay.


October 8, 2012 | 2:04 pm

You’re out of luck with Javascript. If you don’t mind firing up a JVM, you could consider Python (https://github.com/cassiel/net.loadbang.jython ) or Clojure (https://github.com/cassiel/net.loadbang.clojure ). I’ve build sequencers and realtime control systems with both.

(I suppose the Rhino engine in the JVM might be a route to scheduler-aware Javascript in Max; I’ve not tried it.)


October 11, 2012 | 3:49 pm

Thank you very much for the answers. I will go with simple standard java if i cannot do it directy in max.

Bye, Dirk.


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