The Basic Parts of a Node for Max Patch
You can think of Node/node.script as a kind of sidecar for your Max motorcycle. It’s a separate application process which lives and runs alongside your Max patch.
There are three components that make up a N4M patch:
- The Max patch itself contains all your patching and your node.script object
- Messages that are used to communicate with a node.script object, including inlet and outlet messages
Each node.script object in your Max patch represents a single instance of a Node program. It’s possible to have multiple instances pointing to the same JS File, but that also implies multiple instances of the program!
- The program can import and use libraries from the Node JS API. This lets you make HTTP requests, access the file system and more. For more information on the Node JS API, see: https://nodejs.org/dist/latest-v10.x/docs/api/
- To communicate bi-directionally with your Max Patch, import the max-api module ( https://docs.cycling74.com/nodeformax/api/index.html ). This contains functions for sending messages to, and receiving messages from Max. You can also open the API documentation by sending the message to a node.script object
Control messages sent to a node.script object can be easily identified: they always begin with a prefix. These messages communicate with the node.script process manager, rather than the Node script which is run by Node for Max.
The node.script object can also react to incoming input using the max-api module ( https://docs.cycling74.com/nodeformax/api/index.html ).
Output Message Handling
Output Message Handling is composed of the Max patching you create to handle the messages sent out the left outlet of the node.script object. You’ll usually use a Max route or routepass object to handle that message output in your patching.
Monitoring / node.debug Messages
Monitoring and node.debug messages provide status and error messages that keep you informed about what’s going on in the Node Program itself. The node.script object sends lifecycle messages, information and events out of the rightmost outlet in the form of Max dictionaries.
Note: The form of the lifecycle dictionaries is somewhat complex (as documented here ). To make monitoring easier, you can use node.debug , which covers all the received messages and shows all status information, stdout/stderr logs and other data in an easier to use UI.
|Node For Max Documentation - Table of Contents||Node For Max Documentation - Table of Contents|
|Node For Max - Starting and Stopping||Node For Max - Starting and Stopping|
|Node For Max - Programming Interfaces||Node For Max - Programming Interfaces|
|Node For Max - Script Lifecycle||Node For Max - Script Lifecycle|