Clear reference to Javascript terms for max msp

Andro's icon

Hi Everyone,

Started to dig into the js object from Max. I've got a few months of programming experience with Processing so its not all so new to me.

I find the tutorials pretty deep as I only want to start learning the basics of how Max interacts with Javascript.
I just miss a clear documented reference of the Max internal javascript commands.
The reference to the js object pretty much only covers the messages going into the js object.
I suppose I'm looking for a cheat sheet with the commands and terms that max expects to be used in a javascript fashion.
Is there any place here or on the web that has a clear simple set of tutorials that start off simply and build up to a more complex level ??
Its just very time consuming going through the mozilla javascript page and the tutorials just to find some simple examples.
And and all help appreciated.

Jan M's icon

Hi ANDRO,

JavaSript in Max is mainly plain JavasScript. An easier way to get into JS are the ref pages and tutorials from the w3shools http://www.w3schools.com/js/default.asp rather than the Mozilla pages.

There are basically two way to use JS in Max (as you might already know): the [js] object and the [jsui] object. All you can do within [js] you can do in [jsui] as well but the latter one is designed to create graphical interfaces.

There are two ways you can think about JavaScript in Max:
- With JS you can i.e create your own Max objects to realize tasks that are not as straight forward to achieve in Max. I.e dealing with Strings and Arrays or things that require recursive programming structure.
- The other one is to think about it as a "remote control" for for your Max patch. Most things that are in your Max patch are accessible via JavaScript. For this part the Max implementation offers non standard objects (the ones from the documentation) like the MaxObject (a representation of Max itself), the PatcherObject, the MaxobjObject (a representation of a MaxObject) and others. So it comes is very handy if you need to dynamically create UIs or it is a much cleaner way for dynamic patching then [thispatcher] if the tasks are more complex.

There are of course some other things about that topic. And others might have a different approach. But maybe it gives you a start.

I us JS extensively for complex data handling and with the LiveAPI object.

Unlike Processing (AFAIK - not a Processing guy :) but from the sound department ) in most JavaScript use cases (at least within [js]) it will be about inputting a message -> doing ->something ->outputting a message/interacting with your patcher and not so much to create "standalone" tasks.

Maybe that helps a bit to get into it...

Cheers,
Jan

11OLSEN's icon

might be useful to do a search on max js examples. i know many people here have released their collections. or start with the Max7/examples/javascript folder. then you will see very clear how to handle inlets/outlets and the other max related stuff. O.

Andro's icon

Hi Jan, 11Olesen,

Thank you for such an informative explanation !
The W3schools.com page is far clearer to go through than the mozilla page :)
js examples on the forum brings up a lot of clear examples :) (easy to miss the simple things )
I think its just a matter of me getting my head around the way the inlets and outlets work, and how to define the data such as lists and arrays that go into the Js object.
Thanks !!!