Node for Max
Node for Max lets you write custom applications using the Node JavaScript framework, and then control and communicate with those applications from Max. Using Node for Max allows you to run a web server, access your computer’s operating system, communicate with remote data services and make use of the vast resources of the npm package community.
Node for Max is primarily managed through a single Max object: node.script.
The node.script object requires an argument that corresponds to either the name of a JavaScript file or the name of a folder containing an npm package.
When the node.script object receives a message, it will start a Node process defined by the file or package folder specified by the argument.
Once the process is started, messages to the inlet of node.script will be passed to the Node process. Messages from the Node process can be received from the left outlet of node.script.
Basic Concepts
- Each node.script object in your Max patch can run a single process.
- Each program run in a node.script object runs as a separate process from all other processes in other node.script objects.
- A program run in a node.script object must be explicitly started with a message before it can accept input/commands.
Versions
This version of Node for Max uses Node
and npmContents
- Anatomy of an N4M Patch
- Using npm
- Working with Projects and Max for Live Devices
- Differences between the js object and the node.script object
- Stopping, starting and auto-starting a process
- Using the node.debug object
- The node.scriptJS API and max-api Module
- The node.script lifecycle
- Using custom binaries for Node and npm
- Remote debugging
- stdin, stdout and stderr with node.script
- Using ECMAScript modules with node.script
You can find examples of the node.script object at work in the help file: node.script.maxhelp
There is a range of content available to either get you started with Node for Max, learn more about basic concepts or get inspired by projects other users have been using it for:
- The node.script helpfile offers examples on how to use and integrate Node for Max with your Max patch.
- Node for Max JavaScript API is documented at https://docs.cycling74.com/nodeformax/api/ .
- We have started a growing repository of Core Examples that show the concepts of Node for Max using practical examples and JavaScript code on GitHub: https://github.com/Cycling74/n4m-core-examples
- While the former provides a number of focused examples, the Cycling ’74 GitHub also contains a set of small-sized projects that show typical use-cases. These include examples that integrate a Web Server into your Max patch, or connecting your patch it to the Freesound API. You can download these examples at https://github.com/cycling74/n4m-examples
- If you are looking for even more inspiration - Max users are sharing their projects and patches using Node for Max on a separate repository. Feel free to browse them or maybe even contribute at https://github.com/Cycling74/n4m-community
See Also
Name | Description |
---|---|
node.script | |
js | Execute Javascript |